I need to get all documents that contain at least one item from a list of more than 1024.
My query is basically a bool query with a should and minimum_should_match: 1.
Elasticsearch maxClauseCount is set to 1024 by default. I have tried to set it to 4096 and the configuration looks to be ok:
I request http://myserver:9200/my_index/_settings and get:
...
"query": {
"bool": {
"max_clause_count": "4096"
}
}
...,
But if I try still get TooManyClauses[maxClauseCount is set to 1024]
in my logs.
1st Question: Why is this contradictory?
I have read that for some cases it is better to use a filter instead of a large bool:
In general I'd recommend to rewrite that query to use terms filter instead of boolean query https://discuss.elastic.co/t/too-many-clauses-maxclausecount-is-set-to-1024/61968
2nd Question: How could I use a filter to obtain the same logic as the multiple should bool on my example? What is best bool filter or filtered filter for that case?