Hey,
I'm doing some discovery around the nested query feature elasticsearch
supports and I need to use the max score_mode.
I'm expecting to see document id 100 before 101 since id 100 has the full
phrase "Porsche Engine V6" but from some reason document id 101 appears
before in the search results.
Is there any explanations for that?
Thanks,
Itay
Query:
{
"query": {
"nested": {
"path": "Relations",
"score_mode": "max",
"query": {
"query_string": {
"fields": [
"Relations.Title"
],
"query": "Engine V6 porsche"
}
}
}
}
}
Data Set:
id 100
{
"Title": "2007 Porsche 911",
"Relations": [
{
"Title": "Porsche Engine V6"
},
{
"Title": "V6"
},
{
"Title": "BMW v3"
}
]
}
id 101
{
"Title": "2005 Porsche 911",
"Relations": [
{
"Title": "Best Engine V6"
},
{
"Title": "Good condition Porsche Engine V6"
},
{
"Title": "V6 porsche"
}
]
}
Result:
{
"took": 16,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 2.197319,
"hits": [
{
"_index": "searchtest_es",
"_type": "test",
"_id": "101",
"_score": 2.197319,
"_source": {
"Title": "2005 Porsche 911",
"Relations": [
{
"Title": "Best Engine V6"
},
{
"Title": "Good condition Porsche Engine V6"
},
{
"Title": "V6 porsche"
}
]
}
},
{
"_index": "searchtest_es",
"_type": "test",
"_id": "100",
"_score": 2.149176,
"_source": {
"Title": "2007 Porsche 911",
"Relations": [
{
"Title": "Porsche Engine V6"
},
{
"Title": "V6"
},
{
"Title": "BMW v3"
}
]
}
}
]
}
}
--