Relevance scoring helps show the most useful search results first. It ranks results by how well they match your search.
Why relevance scoring ranks results in Elasticsearch
GET /index/_search
{
"query": {
"match": {
"field": "search term"
}
}
}The match query scores documents based on how well they match the search term.
Higher scores mean better matches and appear higher in results.
GET /books/_search
{
"query": {
"match": {
"title": "adventure"
}
}
}GET /products/_search
{
"query": {
"match": {
"description": "wireless headphones"
}
}
}This search looks for documents in the 'library' index where the 'summary' field matches 'climate change'. Elasticsearch scores each document by how well it matches, so the best matches appear first.
GET /library/_search
{
"query": {
"match": {
"summary": "climate change"
}
}
}Relevance scores are numbers that show how well a document matches the query.
Scores depend on factors like term frequency and how rare the term is in all documents.
You can customize scoring to fit your needs using different query types and functions.
Relevance scoring ranks search results by how well they match your query.
Higher scores mean better matches and appear first in results.
This helps users find the most useful information quickly.