Elasticsearch - set max_clause_count

elasticsearch

Solution

Background

NOTE: The advice given in this answer only applies to versions of Elasticsearch below 5.5. The method described references a property that was eventually removed in 5.5.

Search Settings

The setting `index.query.bool.max_clause_count` has been removed. In order to set the maximum number of boolean clauses `indices.query.bool.max_clause_count` should be used instead.

- Ref - Breaking changes in 5.0 » Settings changes

Original Answer

Add the following:

index.query.bool.max_clause_count: 10240

To the file `elasticsearch.yml` on each node of the cluster, then of course, restart the nodes (any change in the config file needs a restart).

Problem

I have a pretty big terms query in elasticsearch, so I get `too_many_clauses: maxClauseCount is set to 1024` I tried increasing it in the elasticsearch.yml by ``` index: query: bool: max_clause_count: 10240 ``` and via ``` curl -XPUT "http://localhost:9200/plastic/_settings" -d '{ "index" : { "max_clause_count" : 10000 } }' ``` but nothing worked. My index is named plastic.

Original source