Introduction to Relevance Scoring
- Relevance scoring is a mechanism used by Elasticsearch to rank documents according to how well they match a search query.
When we perform a search, Elasticsearch calculates a relevance score for each document which is then used to sort the search results. - The default relevance scoring algorithm used by Elasticsearch is the BM25 algorithm, which is a modern version of the TF-IDF (Term Frequency-Inverse Document Frequency) model.
- BM25 considers several factors, including term frequency, inverse document frequency, and field length normalization, to compute a score.
Relevance Scoring and Search Relevance in Elasticsearch
Elasticsearch is a powerful search engine that good at full–text search among other types of queries. One of its key features is the ability to rank search results based on relevance. Relevance scoring determines how well a document matches a given search query and ensures that the most relevant results appear at the top.
In this article, we will understand relevance scoring in Elasticsearch with detailed examples and outputs to make the concepts simple and easy to learn.