Reputation: 49
The main difference between must and filter query is the _score calculation. Can anyone tell me what is the purpose of the score shown in the query result? How can we use the score?
Upvotes: 0
Views: 62
Reputation: 2547
The score gives you the relevance of a given document to the executed query. The higher the score, the more relevant is the document. For example, consider the following documents:
# Doc 1
{
"title": "What is the purpose of score for a user in elastic search query result?"
}
# Doc 2
{
"title": "What is the purpose of score in life?"
}
Then, if you query for a title that includes the words purpose score elastic
(something you would do, for example, in the stackoverflow search bar), the first document will get a higher score and will appear on top of the list of results.
On the other hand, filters tell you whether a document matches or not the query. It is either a yes or no, therefore, it is not necessary to calculate the score.
For further details, have a read at the always very good Elastic documentation.
Upvotes: 1