Hi guys,
I'm trying to speed up a complex query and currently I have the following:
{ "query" : { "filtered": { "query": { "bool": { "should": [ {"multi_match": { "query": "term1", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}}, {"multi_match": { "query": "term2", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}},indent preformatted text by 4 spaces {"multi_match": { "query": "term3", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}}, {"multi_match": { "query": "term4", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}}, {"multi_match": { "query": "term5", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}}, {"multi_match": { "query": "term6", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}}, {"multi_match": { "query": "term7", "type":"phrase","fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ]}} ] } }, "filter" : { "range" : { "createDate" : { "gte":"2015-01-01 00:00:01", "lte":"2015-01-05 23:59:59", "format": "yyyy-MM-dd HH:mm:ss" } } } } } }
It's really slow. I have 15m documents and field1, field2... field6 is analyzed.
Note that if I run the following:
{ "query" : { "multi_match": { "query": "term", "type": "phrase", "fields": [ "field1", "field2", "field3", "field4", "field5", "field6" ] } }, "filter" : { "range" : { "createDate" : { "gte":"2015-01-01 00:00:01", "lte":"2015-01-05 23:59:59", "format": "yyyy-MM-dd HH:mm:ss" } } } } }
it's quite fast. I know that the two queries are not the same but I have to search in several analyzed fields based on several keywords. How can I speed up the first query?