Hello!
I found a bug calculating max_score
with a collapse field and with track_scores
set to true.
How to replicate:
Elasticsearch 7.6 (tested in official docker container)
# Create empty index
PUT /new_index
# Insert some data
POST /new_index/_doc
{
"name": "test 1",
"age": 20
}
POST /new_index/_doc
{
"name": "test 2",
"age": 20
}
POST /new_index/_doc
{
"name": "test 3",
"age": 30
}
# Do the query
GET /new_index/_search
{
"query": {
"match": {
"name": "test"
}
},
"collapse": {"field": "age"},
"track_scores": true
}
# Response
{
"took" : 12,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 3,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
{
"_index" : "new_index",
"_type" : "_doc",
"_id" : "cZShCHIBA1Cl-N7kRxqL",
"_score" : 0.13353139,
"_source" : {
"name" : "test 1",
"age" : 20
},
"fields" : {
"age" : [
20
]
}
},
{
"_index" : "new_index",
"_type" : "_doc",
"_id" : "c5ShCHIBA1Cl-N7kkBrH",
"_score" : 0.13353139,
"_source" : {
"name" : "test 3",
"age" : 30
},
"fields" : {
"age" : [
30
]
}
}
]
}
}
As you can see, the max_score is null even with track_scores in true with a simple query.
Could someone verify this issue to open the issue in github?
Thanks.
Regards.
Antonio.