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

**URL:** <https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858>\
**Category:** Elasticsearch\
**Created:** [March 5, 2019, 9:53am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858 "2019-03-05T09:53:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![raulk89](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@raulk89](https://discuss.elastic.co/u/raulk89)\
**Post date:** [March 5, 2019, 9:53am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/1 "2019-03-05T09:53:06Z")

</div>

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]

```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 5, 2019, 9:58am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/2 "2019-03-05T09:58:25Z")

</div>

This is being tracked here: [https://github.com/elastic/elasticsearch/issues/39528](https://github.com/elastic/elasticsearch/issues/39528)

---

<div class="post-metadata">

**Author:** ![raulk89](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@raulk89](https://discuss.elastic.co/u/raulk89)\
**Post date:** [March 5, 2019, 10:01am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/3 "2019-03-05T10:01:20Z")

</div>

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

Regards  
Raul

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 5, 2019, 10:14am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/4 "2019-03-05T10:14:50Z")

</div>

> [@raulk89](#):
>
> Thanks, on what version this will be fixed..?

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:

```auto
    "bool": {
        "should": [
            {
                "bool":{
                    "should":shoulds1
                }
            },
            {
                "bool":{
                    "should":shoulds2
                }
            }
        ]

```

---

<div class="post-metadata">

**Author:** ![raulk89](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@raulk89](https://discuss.elastic.co/u/raulk89)\
**Post date:** [March 5, 2019, 10:38am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/5 "2019-03-05T10:38:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 5, 2019, 10:43am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/6 "2019-03-05T10:43:38Z")

</div>

> [@raulk89](#):
>
> I'd think that they fix this on next release, 6.6.2

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).

---

<div class="post-metadata">

**Author:** ![raulk89](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@raulk89](https://discuss.elastic.co/u/raulk89)\
**Post date:** [March 5, 2019, 10:56am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/7 "2019-03-05T10:56:17Z")

</div>

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

Regards  
Raul

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 2, 2019, 10:56am UTC](https://discuss.elastic.co/t/booleanquery-toomanyclauses-buyt-have-updated-config-file-to-increase-it/170858/8 "2019-04-02T10:56:18Z")

</div>

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