โ Elasticsearch learning pathElasticsearch ยท Module 5 of 10
Relevance and scoring
Elasticsearch scores documents with BM25 and lets you tune it.
๐ Key ideas
- BM25 rewards terms that appear often in a document but rarely across the index.
- Matches in short fields count more than in long ones.
- Boosting (title^3) gives some fields more weight.
- function_score can add popularity or recency.
- The explain API shows how a score was calculated.
๐ก Real-life example: Like judging a quiz answer: a rare correct keyword earns more marks than a common word everyone wrote.
BM25Default relevance formula
BoostExtra weight for a field or clause
IDFRarer terms count more
explainAPI that shows score details