Incorrect relevance score of documents

Hi,
I just started with the elastic search tutorial and was following the the documentation on full-text search from https://www.elastic.co/guide/en/elasticsearch/guide/current/_full_text_search.html
When I ran the same query in kibana console I got this result.
Input:

GET /megacorp/employee/_search
{
"query" : {
"match" : {
"about" : "rock climbing"
}
}
}
Output:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0.26742277,
"hits": [
{
"_index": "megacorp",
"_type": "employee",
"_id": "2",
"_score": 0.26742277,
"_source": {
"first_name": "Jane",
"last_name": "Smith",
"age": 32,
"about": "I like to collect rock albums",
"interests": [
"music"
]
}
},
{
"_index": "megacorp",
"_type": "employee",
"_id": "1",
"_score": 0.24825554,
"_source": {
"first_name": "John",
"last_name": "Smith",
"age": 25,
"about": "I love to go rock climbing",
"interests": [
"sports",
"music"
]
}
}
]
}
}

The relevance here is incorrect. Am I doing something wrong.
FYI I followed the tutorial as is from the start and didn't modified the docs for indexing.

Can you please post the output of GET /megacorp/_search?size=0 ?

1 Like

{
"took": 18,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0,
"hits": []
}
}

You have a third document indexed there. That affects scoring. For more info see https://www.elastic.co/guide/en/elasticsearch/guide/current/controlling-relevance.html

Also try with one shard only

1 Like

Nice catch @dadoonet

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.