Skip to content

Commit

Permalink
Fix workaround for Elasticsearch 7.x (mastodon#13828)
Browse files Browse the repository at this point in the history
  • Loading branch information
noellabo authored and dariusk committed Jul 22, 2020
1 parent 1ace0ac commit 79acdc3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/initializers/chewy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,22 @@ def enabled?
# Mastodon is run with hidden services enabled, because
# ElasticSearch is *not* supposed to be accessed through a proxy
Faraday.ignore_env_proxy = true

# Elasticsearch 7.x workaround
Elasticsearch::Transport::Client.prepend Module.new {
def search(arguments = {})
arguments[:rest_total_hits_as_int] = true
super arguments
end
}
Elasticsearch::API::Indices::IndicesClient.prepend Module.new {
def create(arguments = {})
arguments[:include_type_name] = true
super arguments
end

def put_mapping(arguments = {})
arguments[:include_type_name] = true
super arguments
end
}

0 comments on commit 79acdc3

Please sign in to comment.