TooManyClauses error in Query String query - trying to rewrite

Hello,

My query_string query gives me a TooManyClauses exception, and I am trying
to avoid it with the rewrite parameter. This is my original query:

{
"query" : {
"query_string" : {
"query" : "+substance +ATT_UUID:* +filename:*pdf",
"default_field" : "fileTextContent.fileTextContentAnalyzed"
}
},
"fields" : [ "attachmentType", "DOS_UUID", "ATT_UUID", "filename",
"isCSR", "mime", "md5", "filesize" ],
"highlight" : {
"fields" : {
"fileTextContent.fileTextContentAnalyzed" : { }
}
}
}

and it gives me the TooManyClauses error:

{
"error": "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], all shards failed; shardFailures
{[S8DPjOR9TKmCzMhnQXeo7g][markosindex][0]:
FetchPhaseExecutionException[[markosindex][0]:
query[+fileTextContent.fileTextContentAnalyzed:substance +ATT_UUID:*
+filename:*pdf],from[0],size[10]: Fetch Failed [Failed to highlight field
[fileTextContent.fileTextContentAnalyzed]]]; nested:
TooManyClauses[maxClauseCount is set to 1024]; }]",
"status": 500
}

This is normal I guess since I am using wildcards, so under the hood this
is translated to multiple boolean clauses that exceed the default 1024
limit. I tried to use the rewrite parameter, as instructed in several posts
(the Query String Query
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
does support rewrite
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-multi-term-rewrite.html).
However, the rewrite parameter seems to be ignored, as any of the values
gives the same error as before. My query is below, what something wrong
with it?

Thanks!

{
"query" : {
"query_string" : {
"query" : "+substance +DOS_UUID:* +ATT_UUID:* +filename:*pdf",
"default_field" : "fileTextContent.fileTextContentAnalyzed",

  •  "rewrite": "constant_score_filter"*
    
    }
    },
    "fields" : [ "attachmentType", "DOS_UUID", "ATT_UUID", "filename",
    "isCSR", "mime", "md5", "filesize" ],
    "highlight" : {
    "fields" : {
    "fileTextContent.fileTextContentAnalyzed" : { }
    }
    }
    }

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e8720ab9-39f6-4c48-a9b7-e9fd135ef897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.