Difference between Elasticsearch range query and range filter

I want to query elasticsearch documents within a date range. I have two options, both work just fine for me. Tested them both. 1. Range request 2. Range filter

Since I currently have a small data set, I can’t check the performance for both of them. What is the difference between the two? and which one will lead to faster document retrieval and faster reaction?

+4
source share
2 answers

The main difference between queries and filters is related to counting. Requests return documents with a relative rating score for each document. There are no filters. This difference allows the filter to be faster for two reasons. Firstly, it does not bear the cost of calculating the score for each document. Secondly, he can cache the results, since he does not need to deal with possible changes in the account from moment to moment - this is just a logical value, does the document correspond or not?

From the documentation:

Filters are usually faster than queries because:

they don’t need to calculate the _score relevance for each document - the answer is simply logical “Yes, the document matches the filter” or “No, the document does not match the filter”. The results of most filters can be cached in memory, which speeds up subsequent quotes.

, , ? , - . , , , . , (, : "EN" ) ​​ , . , .

, . :

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html

http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/query-dsl-filtered-query.html

http://exploringelasticsearch.com/searching_data.html

http://elasticsearch-users.115913.n3.nabble.com/Filters-vs-Queries-td3219558.html

+4

Source: https://habr.com/ru/post/1547060/


All Articles