The setting is refelected when I check my index settings at http://localhost:9200/myindex/_settings with this line:
index.query.bool.max_clause_count: "1000000"
Despite this, when I run a query, I get the below error stating that
the max_clause_count is the default 1024:
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses:
maxClauseCount is set to 1024
Any insight to why despite the setting showing the max_clause_count as
set to 1000000, that Elasticsearch is still throwing that error?
The setting should go in the elasticsearch config (there where the
analyzers go), not in the index settings.
And: are you really need more than 1024 clauses (can be bad in terms
of RAM)? Why not using a boolean filter or a terms filter? Or are you
hitting the limit because of some query expansion of a different
query?
The setting is refelected when I check my index settings at http://localhost:9200/myindex/_settings with this line:
index.query.bool.max_clause_count: "1000000"
Despite this, when I run a query, I get the below error stating that
the max_clause_count is the default 1024:
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses:
maxClauseCount is set to 1024
Any insight to why despite the setting showing the max_clause_count as
set to 1000000, that Elasticsearch is still throwing that error?
Thanks for your response. I am using a terms filter where I'm
filtering against thousands of accounts. It appears this is why I was
hitting the 1024 limit.
The setting should go in the elasticsearch config (there where the
analyzers go), not in the index settings.
And: are you really need more than 1024 clauses (can be bad in terms
of RAM)? Why not using a boolean filter or a terms filter? Or are you
hitting the limit because of some query expansion of a different
query?
Despite this, when I run a query, I get the below error stating that
the max_clause_count is the default 1024:
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses:
maxClauseCount is set to 1024
Any insight to why despite the setting showing the max_clause_count as
set to 1000000, that Elasticsearch is still throwing that error?
Despite this, when I run a query, I get the below error stating that
the max_clause_count is the default 1024:
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses:
maxClauseCount is set to 1024
Any insight to why despite the setting showing the max_clause_count as
set to 1000000, that Elasticsearch is still throwing that error?
Despite this, when I run a query, I get the below error stating that
the max_clause_count is the default 1024:
Caused by: org.apache.lucene.search.BooleanQuery$TooManyClauses:
maxClauseCount is set to 1024
Any insight to why despite the setting showing the max_clause_count as
set to 1000000, that Elasticsearch is still throwing that error?
Its being crashed when I am querying single characters as "a","b","c","v"
etc. but not all character, like "z" is giving the response. and the
exception in the former cases is :
Query Failed [Failed to execute main query]]; nested: TooManyClauses[maxClauseCount is set to 1024]; }]
So now I am trying to set the value of max_clause_count in the index as
follows:
index.query.bool.max_clause_count : 10240
but the index is failing to start if the setting is there in the yml file
and starts if I remove the setting.
phrase_prefix or prefix queries don't perform well when there are lots
of matching terms.
They have to:
load all terms beginning with $prefix
construct a query like term_1 OR term_2 OR .....
So yes, if you say "give me everything beginning with 'a'" then you are
going to have a LOT of terms, which will kill your memory and perform
very badly.
That's why there is a limit to the number of terms/clauses. It's there
to protect you.
The way to do this more efficiently is to analyse your text with ngrams
or edge-ngrams.
Its being crashed when I am querying single characters as
"a","b","c","v" etc. but not all character, like "z" is giving the
response. and the exception in the former cases is :
Query Failed [Failed to execute main query]]; nested: TooManyClauses[maxClauseCount is set to 1024]; }]
So now I am trying to set the value of max_clause_count in the index
as follows:
index.query.bool.max_clause_count : 10240
but the index is failing to start if the setting is there in the yml
file and starts if I remove the setting.
Isn't there a way to continue to search even if the clause exceed, like instead of throwing an error, cant we just take the 1024 expanded clauses and continue with our search?
I am also facing the same issue, so wanted to know if we can somehow live with this is error?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.