# Index.query.bool.max\_clause\_count Setting and TermsQueryParser

**URL:** <https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604>\
**Category:** Elasticsearch\
**Created:** [June 10, 2011, 9:03pm UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604 "2011-06-10T21:03:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrawlings](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrawlings/32/3183_2.png) [@jrawlings](https://discuss.elastic.co/u/jrawlings)\
**Post date:** [June 10, 2011, 9:03pm UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/1 "2011-06-10T21:03:02Z")

</div>

In issue #482 ([https://github.com/elasticsearch/elasticsearch/issues/](https://github.com/elasticsearch/elasticsearch/issues/)  
482), Shay mentioned to set the property  
'index.query.bool.max\_clause\_count' in order to raise the max clause  
count for a lucene bool query. I've tried to set this property but it  
doesn't seem to be persisted. Am I doing something wrong? Here's what  
I'm doing: [https://gist.github.com/1019762](https://gist.github.com/1019762)

When I do get around to setting this property, will it fix a Lucene  
TooManyClauses error w/ the TermsQueryParser if I have over 1024  
terms? I noticed that the setting is applied for the the  
BoolQueryParser only from that issue (482).

Any help or thoughts would be greatly appreciated.

Thanks,  
JR

---

<div class="post-metadata">

**Author:** ![Stephane\_Raux](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephane_raux/32/2349_2.png) [@Stephane\_Raux](https://discuss.elastic.co/u/Stephane_Raux)\
**Post date:** [June 11, 2011, 7:51am UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/2 "2011-06-11T07:51:51Z")

</div>

You should provide the property in the following way :  
curl -XPUT "[http://localhost:9200/\_settings](http://localhost:9200/_settings)" -d '

> {  
> "index" : {  
> "query" : {  
> "bool" : {  
> "max\_clause\_count": 2048  
> }  
> }  
> }  
> }  
> '

Best,

Stéphane

2011/6/10 Joe Rawlings [joseph.rawlings@gmail.com](mailto:joseph.rawlings@gmail.com):

> In issue #482 ([Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/)  
> 482), Shay mentioned to set the property  
> 'index.query.bool.max\_clause\_count' in order to raise the max clause  
> count for a lucene bool query. I've tried to set this property but it  
> doesn't seem to be persisted. Am I doing something wrong? Here's what  
> I'm doing: [https://gist.github.com/1019762](https://gist.github.com/1019762)
> 
> When I do get around to setting this property, will it fix a Lucene  
> TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> terms? I noticed that the setting is applied for the the  
> BoolQueryParser only from that issue (482).
> 
> Any help or thoughts would be greatly appreciated.
> 
> Thanks,  
> JR

---

<div class="post-metadata">

**Author:** ![jrawlings](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrawlings/32/3183_2.png) [@jrawlings](https://discuss.elastic.co/u/jrawlings)\
**Post date:** [June 11, 2011, 2:30pm UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/3 "2011-06-11T14:30:14Z")

</div>

That's essentially the same thing I was doing. Still, I tried it and  
the property didn't show up when I retrieved the settings. 😕

On Jun 11, 12:51 am, Stéphane Raux [stephane.r...@gmail.com](mailto:stephane.r...@gmail.com) wrote:

> You should provide the property in the following way :  
> curl -XPUT "[http://localhost:9200/\_settings](http://localhost:9200/_settings)" -d '
> 
> > {  
> > "index" : {  
> > "query" : {  
> > "bool" : {  
> > "max\_clause\_count": 2048  
> > }  
> > }  
> > }  
> > }  
> > '
> 
> Best,
> 
> Stéphane
> 
> 2011/6/10 Joe Rawlings [joseph.rawli...@gmail.com](mailto:joseph.rawli...@gmail.com):
> 
> > In issue #482 ([Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/)  
> > 482), Shay mentioned to set the property  
> > 'index.query.bool.max\_clause\_count' in order to raise the max clause  
> > count for a lucene bool query. I've tried to set this property but it  
> > doesn't seem to be persisted. Am I doing something wrong? Here's what  
> > I'm doing:[https://gist.github.com/1019762](https://gist.github.com/1019762)
> 
> > When I do get around to setting this property, will it fix a Lucene  
> > TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> > terms? I noticed that the setting is applied for the the  
> > BoolQueryParser only from that issue (482).
> 
> > Any help or thoughts would be greatly appreciated.
> 
> > Thanks,  
> > JR

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 12, 2011, 6:05am UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/4 "2011-06-12T06:05:21Z")

</div>

I think that you should remove your index before sending settings.

Try this :  
curl -XDELETE "[http://localhost:9200/myindex](http://localhost:9200/myindex)" -d ' {}'

curl -XPUT "[http://localhost:9200/myindex/\_settings](http://localhost:9200/myindex/_settings)" -d '  
{  
"index" : {  
"query" : {  
"bool" : {  
"max\_clause\_count": 2048  
}  
}  
}  
}  
'

Hope this helps.  
David 😉

Le 11 juin 2011 à 16:30, Joe Rawlings [joseph.rawlings@gmail.com](mailto:joseph.rawlings@gmail.com) a écrit :

> That's essentially the same thing I was doing. Still, I tried it and  
> the property didn't show up when I retrieved the settings. 😕
> 
> On Jun 11, 12:51 am, Stéphane Raux [stephane.r...@gmail.com](mailto:stephane.r...@gmail.com) wrote:
> 
> > You should provide the property in the following way :  
> > curl -XPUT "[http://localhost:9200/\_settings](http://localhost:9200/_settings)" -d '
> > 
> > > {  
> > > "index" : {  
> > > "query" : {  
> > > "bool" : {  
> > > "max\_clause\_count": 2048  
> > > }  
> > > }  
> > > }  
> > > }  
> > > '
> > 
> > Best,
> > 
> > Stéphane
> > 
> > 2011/6/10 Joe Rawlings [joseph.rawli...@gmail.com](mailto:joseph.rawli...@gmail.com):
> > 
> > > In issue #482 ([Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/)  
> > > 482), Shay mentioned to set the property  
> > > 'index.query.bool.max\_clause\_count' in order to raise the max clause  
> > > count for a lucene bool query. I've tried to set this property but it  
> > > doesn't seem to be persisted. Am I doing something wrong? Here's what  
> > > I'm doing:[https://gist.github.com/1019762](https://gist.github.com/1019762)
> > 
> > > When I do get around to setting this property, will it fix a Lucene  
> > > TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> > > terms? I noticed that the setting is applied for the the  
> > > BoolQueryParser only from that issue (482).
> > 
> > > Any help or thoughts would be greatly appreciated.
> > 
> > > Thanks,  
> > > JR

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 12, 2011, 7:36am UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/5 "2011-06-12T07:36:05Z")

</div>

You can't set this setting "on the fly", since it gets applied when an index gets created.

On Sunday, June 12, 2011 at 9:05 AM, David Pilato wrote:

> I think that you should remove your index before sending settings.
> 
> Try this :  
> curl -XDELETE "[http://localhost:9200/myindex](http://localhost:9200/myindex)" -d ' {}'
> 
> curl -XPUT "[http://localhost:9200/myindex/\_settings](http://localhost:9200/myindex/_settings)" -d '  
> {  
> "index" : {  
> "query" : {  
> "bool" : {  
> "max\_clause\_count": 2048  
> }  
> }  
> }  
> }  
> '
> 
> Hope this helps.  
> David 😉
> 
> Le 11 juin 2011 à 16:30, Joe Rawlings \<[joseph.rawlings@gmail.com](mailto:joseph.rawlings@gmail.com) ([mailto:joseph.rawlings@gmail.com](mailto:joseph.rawlings@gmail.com))\> a écrit :
> 
> > That's essentially the same thing I was doing. Still, I tried it and  
> > the property didn't show up when I retrieved the settings. 😕
> > 
> > On Jun 11, 12:51 am, Stéphane Raux \<[stephane.r...@gmail.com](mailto:stephane.r...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > 
> > > You should provide the property in the following way :  
> > > curl -XPUT "[http://localhost:9200/\_settings](http://localhost:9200/_settings)" -d '
> > > 
> > > > {  
> > > > "index" : {  
> > > > "query" : {  
> > > > "bool" : {  
> > > > "max\_clause\_count": 2048  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > '
> > > 
> > > Best,
> > > 
> > > Stéphane
> > > 
> > > 2011/6/10 Joe Rawlings \<[joseph.rawli...@gmail.com](mailto:joseph.rawli...@gmail.com) ([http://gmail.com](http://gmail.com))\>:
> > > 
> > > > In issue #482 ([Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/)  
> > > > 482), Shay mentioned to set the property  
> > > > 'index.query.bool.max\_clause\_count' in order to raise the max clause  
> > > > count for a lucene bool query. I've tried to set this property but it  
> > > > doesn't seem to be persisted. Am I doing something wrong? Here's what  
> > > > I'm doing:[https://gist.github.com/1019762](https://gist.github.com/1019762)
> > > 
> > > > When I do get around to setting this property, will it fix a Lucene  
> > > > TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> > > > terms? I noticed that the setting is applied for the the  
> > > > BoolQueryParser only from that issue (482).
> > > 
> > > > Any help or thoughts would be greatly appreciated.
> > > 
> > > > Thanks,  
> > > > JR

---

<div class="post-metadata">

**Author:** ![jrawlings](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrawlings/32/3183_2.png) [@jrawlings](https://discuss.elastic.co/u/jrawlings)\
**Post date:** [June 13, 2011, 4:37pm UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/6 "2011-06-13T16:37:21Z")

</div>

Cool, so I started reindexing my data with the  
"index.query.bool.max\_clause\_count" set to 8192 and retried the query  
that was causing the issue before. The same 'maxClauseCount is set to  
1024' error showed up again. I put a breakpoint in the BoolQueryParser  
and reran the query but nothing was hit. Any thoughts?

On Jun 10, 2:03 pm, Joe Rawlings [joseph.rawli...@gmail.com](mailto:joseph.rawli...@gmail.com) wrote:

> When I do get around to setting this property, will it fix a Lucene  
> TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> terms? I noticed that the setting is applied for the the  
> BoolQueryParser only from that issue (482).

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [June 13, 2011, 5:12pm UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/7 "2011-06-13T17:12:38Z")

</div>

You don't need to reindex your data for that... . You could have closed and reopened your index for example. Or just set it in the elasticsearch.yml file. This setting is tricky, since its a static one (Lucene wise). So, I suggest setting it in the elasticsearch.yml file so it will always apply.

On Monday, June 13, 2011 at 7:37 PM, Joe Rawlings wrote:

> Cool, so I started reindexing my data with the  
> "index.query.bool.max\_clause\_count" set to 8192 and retried the query  
> that was causing the issue before. The same 'maxClauseCount is set to  
> 1024' error showed up again. I put a breakpoint in the BoolQueryParser  
> and reran the query but nothing was hit. Any thoughts?
> 
> On Jun 10, 2:03 pm, Joe Rawlings \<[joseph.rawli...@gmail.com](mailto:joseph.rawli...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> 
> > When I do get around to setting this property, will it fix a Lucene  
> > TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> > terms? I noticed that the setting is applied for the the  
> > BoolQueryParser only from that issue (482).

---

<div class="post-metadata">

**Author:** ![jrawlings](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrawlings/32/3183_2.png) [@jrawlings](https://discuss.elastic.co/u/jrawlings)\
**Post date:** [June 13, 2011, 5:31pm UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/8 "2011-06-13T17:31:14Z")

</div>

Perfect, thank you

On Jun 13, 10:12 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> You don't need to reindex your data for that... . You could have closed and reopened your index for example. Or just set it in the elasticsearch.yml file. This setting is tricky, since its a static one (Lucene wise). So, I suggest setting it in the elasticsearch.yml file so it will always apply.
> 
> On Monday, June 13, 2011 at 7:37 PM, Joe Rawlings wrote:
> 
> > Cool, so I started reindexing my data with the  
> > "index.query.bool.max\_clause\_count" set to 8192 and retried the query  
> > that was causing the issue before. The same 'maxClauseCount is set to  
> > 1024' error showed up again. I put a breakpoint in the BoolQueryParser  
> > and reran the query but nothing was hit. Any thoughts?
> 
> > On Jun 10, 2:03 pm, Joe Rawlings \<[joseph.rawli...@gmail.com](mailto:joseph.rawli...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > 
> > > When I do get around to setting this property, will it fix a Lucene  
> > > TooManyClauses error w/ the TermsQueryParser if I have over 1024  
> > > terms? I noticed that the setting is applied for the the  
> > > BoolQueryParser only from that issue (482).

---

<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:** [July 6, 2017, 4:03am UTC](https://discuss.elastic.co/t/index-query-bool-max-clause-count-setting-and-termsqueryparser/4604/9 "2017-07-06T04:03:43Z")

</div>


