Bool Query Execution Order


#1

Do you belive ElasticSearch will try to search the documents according to the right order in the following query?

I know from this post that Elasticsearch has its own mechanism for execution based on statistics, and therefore might change the order of execution.

The reason I ask about it, is becuase I want to know wether using a manipulated maxReviewDate field will boost performance (as you can see, I run this query on many indices). This field is store in the parent docs and maintaied for its nested docs. It's known that nested queries are slower than regular non-nested queries, and it would be nice to know that the nested query will run only when it has to run.

GET Products_January, Products_February, Products_March / _search {
	"query" : {
		"bool" : {
			"must" : [{
					"range" : {
						"maxReviewDate" : {
							"gte" : "2018-02-14 00:00:00"
						}
					}
				}, {
					"nested" : {
						"path" : "Reviews",
						"query" : {
							"term" : {
								"Reviews.User" : "John"
							}
						}
					}
				}
			]
		}
	}
}

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.