0

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}
Cannon Moyer
  • 3,014
  • 3
  • 31
  • 75

1 Answers1

0

I hate to ask this but just in case this is the issue, this is a static Lucene setting, it can only be set in the Elasticsearch config file and get picked up at startup. Did you restart your cluster after making the config change?