Skip to content
This repository was archived by the owner on Dec 21, 2023. It is now read-only.

Commit 1c43461

Browse files
authored
Fix workaround for Elasticsearch 7.x (mastodon#13828)
1 parent e6706d1 commit 1c43461

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

config/initializers/chewy.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,22 @@ def enabled?
2929
# Mastodon is run with hidden services enabled, because
3030
# ElasticSearch is *not* supposed to be accessed through a proxy
3131
Faraday.ignore_env_proxy = true
32+
33+
# Elasticsearch 7.x workaround
34+
Elasticsearch::Transport::Client.prepend Module.new {
35+
def search(arguments = {})
36+
arguments[:rest_total_hits_as_int] = true
37+
super arguments
38+
end
39+
}
40+
Elasticsearch::API::Indices::IndicesClient.prepend Module.new {
41+
def create(arguments = {})
42+
arguments[:include_type_name] = true
43+
super arguments
44+
end
45+
46+
def put_mapping(arguments = {})
47+
arguments[:include_type_name] = true
48+
super arguments
49+
end
50+
}

0 commit comments

Comments
 (0)