How many clauses can go in a bool filter by default?

^ Trying to track down a bug and i think it's related. I have a query that may be creating up to 2200 clauses within the "should" block of a bool query.

I think the default maximum clause count for lucene BooleanQuery is 1024, but theres the indices.query.bool.max_clause_count setting where you can increase this:

However be sure to measure the impact that queries of that size can have on your cluster.

are there best practices for setting this value? or a known point at which it becomes an issue because the query is too long?

That said, is there a cap on the length of queries? what is that value, if so?

many thanks, sorry for the machine gun questions!

Great question,

I have a feeling this limit is more a kind of safeguard for people to not shoot themselves in the foot by accidentaly adding too much clauses (or users DOSing your search engine by querying for gazillions of terms) or creating overly complicated queries to begin with. These queries will probably be slower, but I this also depends on the kind of data you have. The right limit also seems to be debated in the Lucene community itself when you look at their discussions.
So I get the feeling that increasing the limit by - say a factor of 10x - should not be problematic although your queries might get slower. I'd be interested in other peoples opinions about this though.