I am using ES 5.2.0 and I got below exception during some query execution:
Caused by: NotSerializableExceptionWrapper[too_many_clauses: maxClauseCount is set to 1024]
at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:125)
at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:449)
at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:418)
To solve this. I am trying to change "indices.query.bool.max_clause_count" value by running below query
Request:
PUT http://localhost:9200/_all/_settings?preserve_existing=true
{"indices.query.bool.max_clause_count" : "100000"}
Response:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[06LrSZC][localhost:9300][indices:admin/settings/update]"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.indices.query.bool.max_clause_count] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}
References I used to solve but couldn't:
https://discuss.elastic.co/t/5-0-0-alpha2-how-to-set-index-query-bool-max-clause-count/49816
https://github.com/elastic/elasticsearch/pull/18341
Please let me know the correct request JSON to do this.
indices.query.bool.max_clause_count
is a static setting so you should set it in elasticsearch.yml
file in each and every node of elasticsearch cluster. You must restart the cluster.
Update your elasticsearch.yml
file with following line:
indices.query.bool.max_clause_count: 100000
Note: Only dynamic settings can be updated with API