I'm using the elasticsearch-rails
gem in Rails 5 and I am trying to increase the max_clause_count
. I'm using version 7.3
of ElasticSearch.
In my elasticsearch.yml file I have added the following code:
indices.query.bool.max_clause_count: 4096
In my initializer, I load the configs like so:
config = {
host: "http://localhost:9200",
transport_options: {
request: { timeout: 200 }
}
}
if File.exists?("config/elasticsearch.yml")
config.merge!(YAML.load_file("config/elasticsearch.yml").symbolize_keys)
end
Elasticsearch::Model.client = Elasticsearch::Client.new(config)
I can still reproduce this error with one of my queries that is rather long and when I do, after loading the configs above I still get the error:
{"type":"too_many_clauses","reason":"maxClauseCount is set to 1024"}
printing the config to the terminal I get this output:
{:host=>"http://localhost:9200", :transport_options=>{:request=>{:timeout=>200}}, :"indices.query.bool.max_clause_count"=>4096}