BooleanQuery$TooManyClauses - buyt have updated config file to increase it

Hi

Elasticsearch version 6.6.1
Centos7

I have set "indices.query.bool.max_clause_count" into my elasticsearch.yml file

indices.query.bool.max_clause_count: 3000

And restarted cluster nodes, but still I get the following errors in my log files, looks like the setting has not taken effect.

Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: too_many_clauses: maxClauseCount is set to 1024
        at org.apache.lucene.search.BooleanQuery$Builder.add(BooleanQuery.java:114) ~[lucene-core-7.6.0.jar:7.6.0 719cde97f84640faa1e3525690d262946571245f - nknize - 2018-12-07 14:44:20]
        at org.elasticsearch.index.query.BoolQueryBuilder.addBooleanClauses(BoolQueryBuilder.java:422) ~[elasticsearch-6.6.1.jar:6.6.1]
        at org.elasticsearch.index.query.BoolQueryBuilder.doToQuery(BoolQueryBuilder.java:385) ~[elasticsearch-6.6.1.jar:6.6.1]
        at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:104) ~[elasticsearch-6.6.1.jar:6.6.1]

This is being tracked here: https://github.com/elastic/elasticsearch/issues/39528

1 Like

Thanks, on what version this will be fixed..?

Regards
Raul

I imagine 6.7.

Workarounds as follows:

If you're using lots of term queries with the same field put their values into an array and use the terms query instead - that does not have limits.

Alternatively, if you have lots of different queries the limit is on the number of clauses within a single should . By breaking up the clauses into multiple bool branches you can nest collections of up to 1024 shoulds without hitting the limit e.g:

    "bool": {
        "should": [
            {
                "bool":{
                    "should":shoulds1
                }
            },
            {
                "bool":{
                    "should":shoulds2
                }
            }
        ]
1 Like

Well, ok. I don't think that our dev team will make this temporary fix, if this would be necessary only for a certain time (until 6.7 is released).
I'd think that they fix this on next release, 6.6.2
6.7 release probably could take weeks/months.
It's a shame though..

Raul

Apologies, I did mean to suggest whatever is the next release. My expectation is that it is a simple bug (e.g. code looking for the wrong setting name).

Ok, thanks for clarifiaction.
Let's hope this fix soon..

Regards
Raul

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.