maxClauseCount not working in elasticsearch

Hi All,

Our es_item Index has higher document count as 438,799,356 and the size of index is 1.3 TB. We are using max_expansions with match_phrase_prefix and below is the value I given in the GET query,
"21321312"

In Our case We have an item_code like "41484359" and it has two std_extrn_code (like "085601700343") with two different xcd ID's. The std_extrn_codes are same for two XCD ID's. Similarly there are so many std_extrn_codes for an single item_code with different xcd ID's.

GET es_item/item/_search
{
"query": {
"filtered": {
"query": {
"nested": {
"query": {
"match_phrase_prefix": {
"STD_EXTRN_CODE_STARTS": {
"query": "0",
** "max_expansions": 21321312**
} } },
"path": "XCD"
} },
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"query": {
"filtered": {
"filter": {
"terms": {
"ITEM_CODE_RAW": [
"41484359"
]
} } } } } ] } } ] } } } } }

Below is the error which I got when I execute the query in sense,

"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[fMZhj1KGT7GanpGh3IE8jQ][es_item][0]: RemoteTransportException[[dayrhetfmi001_ETE_DATA][inet[/10.7.146.21:9261]][indices:data/read/search[phase/query]]]; 
nested: QueryPhaseExecutionException[[es_item][0]: query[filtered(filtered(ToParentBlockJoinQuery(filtered(XCD.STD_EXTRN_CODE.STD_EXTRN_CODE_STARTS:\"0*\")->cache(_type:__XCD)))->BooleanFilter(+BooleanFilter
(QueryWrapperFilter(ConstantScore(cache(ITEM_CODE.ITEM_CODE_RAW:41484359))))))->cache(+_type:item +org.elasticsearch.index.search.nested.NonNestedDocsFilter@abc67639)],from[0],size[10]: Query Failed [Failed to execute main query]]; nested: RuntimeException[org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024];
nested: TooManyClauses[maxClauseCount is set to 1024]; }{[ofHAUdT8TDuIigTUFMSCqg][es_item][1]: QueryPhaseExecutionException[[es_item][1]: query[filtered(filtered(ToParentBlockJoinQuery(filtered(XCD.STD_EXTRN_CODE.STD_EXTRN_CODE_STARTS:\"0*\")->cache(_type:__XCD))) ->BooleanFilter(+BooleanFilter(QueryWrapperFilter(ConstantScore(cache(ITEM_CODE.ITEM_CODE_RAW:41484359))))))
->cache(+_type:item+org.elasticsearch.index.search.nested.NonNestedDocsFilter@fd53b22c)],from[0],size[10]: Query Failed [Failed to execute main query]]; 
nested: RuntimeException[org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024]; nested: TooManyClauses[maxClauseCount is set to 1024]; }{[fMZhj1KGT7GanpGh3IE8jQ][es_item][2]:

I also changed the index.query.bool.max_clause_count value to 10240 in yml file but still i am getting the same error.

Should I have to change max_expansions value also after changed the max_clause_count in yml file?

Please help us to resolve this error.

Thanks,
Ganeshbabu R