NitishDeshpande
NitishDeshpande

Reputation: 495

Elasticsearch: Filter out irrelevant results based on score

When I run a query I get back results with their relevance scores. For example consider the following records in the results with their scores,

I want the records 5 and 6 to be filtered out as you can see they are the irrelevant subset of results. Difference of score between record 3 & 4 is less as compared to the difference between 5 & 4

Is there a way in elasticsearch to filter out the irrelevant results. To use the min_score query you should know the scores before hand hence that will not be a solution

Upvotes: 1

Views: 686

Answers (1)

Persimmonium
Persimmonium

Reputation: 15771

ES is using Lucene under the covers for the scoring, and you cannot know beforehand what range of scores you will get from a query. You could use some function score to normalize scores etc, but it would be very difficult not to find some cases where it would perform badly. It is not recommended.

If you need to know how Lucene calculates the scores, google for BM25.

Upvotes: 1

Related Questions