elasticsearch returning all docs with score=1 when no function matches
I use opensearch 1.2 version on aws but I think it's the behaviour of elasticsearch itself. My query looks like this.
GET order/_search?explain=true
{
"query": {
"function_score": {
"functions": [
{
"filter": {
"bool": {
"must": [
{
"match": {
"customer.id": 3632182362206
}
}
]
}
},
"weight": 1.1
}
],
"min_score": 0.9,
"query": {
"match_all": {}
},
"score_mode": "sum"
}
}
}
This is one of the results that did not match the query.
{
"_shard" : "[order][0]",
"_node" : "HQcAzu18SH-uJKucZLh1jg",
"_index" : "order",
"_type" : "_doc",
"_id" : "4287909068965",
"_score" : 1.0,
"_source": {...}
"_explanation" : {
"value" : 1.0,
"description" : "function score, product of:",
"details" : [
{
"value" : 1.0,
"description" : "*:*",
"details" : [ ]
},
{
"value" : 1.0,
"description" : "min of:",
"details" : [
{
"value" : 1.0,
"description" : "No function matched",
"details" : [ ]
},
{
"value" : 3.4028235E38,
"description" : "maxBoost",
"details" : [ ]
}
]
}
]
}
}
this complex construction helped me perform search with different conditions and params. Weighting works correctly but the problem I'm cannot understand is why it returns all docs if no function matches and why score for documents that did not match should be 1.