Multi_match most_fields doesn't divide score by number of clauses

Hi,

I was trying to understand scores for the following multi_match query using explain: true:

GET /myindex/_search
{
  "size": 5,
  "explain": true,
  "_source": false,
  "query": {
    "bool": {
      "minimum_should_match": 1,
      "should": [
        {
          "multi_match": {
            "query": "hand sanitizer",
            "type": "most_fields",
            "operator": "and",
            "fields": [
              "name",
              "search_terms",
            ]
          }
        }
      ]
    }
  }
}

I get the following result with some keys omitted for clarity

{
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 12,
    "max_score": 21.46976,
    "hits": [
      {
        "_shard": "[myindex][0]",
        "_node": "p1a37bfBRC6CIhegIYWJkA",
        "_index": "myindex",
        "_type": "doc",
        "_id": "1168",
        "_score": 21.46976,
        "_explanation": {
          "value": 21.46976,
          "description": "sum of:",
          "details": [
            {
              "value": 21.46976,
              "description": "sum of:",
              "details": [
                {
                  "value": 9.661456,
                  "description": "sum of:",
                  "details": [
                    {
                      "value": 3.725314,
                      "description": "weight(name:hand in 5739) [PerFieldSimilarity], result of:",
                      "details": [
                        {
                          "value": 3.725314,
                          "description": "score(doc=5739,freq=1.0 = termFreq=1.0\n), product of:",
                          "details": [
                            {
                              "value": 3.1846268,
                              "description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
                              "details": [
                                {
                                  "value": 69,
                                  "description": "docFreq",
                                  "details": []
                                },
                                {
                                  "value": 1678,
                                  "description": "docCount",
                                  "details": []
                                }
                              ]
                            },
                            {
                              "value": 1.1697804,
                              "description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
                              "details": [
                                {
                                  "value": 1,
                                  "description": "termFreq=1.0",
                                  "details": []
                                },
                                {
                                  "value": 1.2,
                                  "description": "parameter k1",
                                  "details": []
                                },
                                {
                                  "value": 0.75,
                                  "description": "parameter b",
                                  "details": []
                                },
                                {
                                  "value": 48.045887,
                                  "description": "avgFieldLength",
                                  "details": []
                                },
                                {
                                  "value": 31,
                                  "description": "fieldLength",
                                  "details": []
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "value": 5.936142,
                      "description": "weight(name:sanitizer in 5739) [PerFieldSimilarity], result of:",
                      "details": [
                        {
                          "value": 5.936142,
                          "description": "score(doc=5739,freq=1.0 = termFreq=1.0\n), product of:",
                          "details": [ "omitted for char count" ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "value": 11.808305,
                  "description": "sum of:",
                  "details": [
                    {
                      "value": 5.508706,
                      "description": "weight(search_terms:hand in 5739) [PerFieldSimilarity], result of:",
                      "details": [
                        {
                          "value": 5.508706,
                          "description": "score(doc=5739,freq=6.0 = termFreq=6.0\n), product of:",
                          "details": [ "omitted for char count" ]
                        }
                      ]
                    },
                    {
                      "value": 6.2995987,
                      "description": "weight(search_terms:sanitizer in 5739) [PerFieldSimilarity], result of:",
                      "details": [
                        {
                          "value": 6.2995987,
                          "description": "score(doc=5739,freq=2.0 = termFreq=2.0\n), product of:",
                          "details": [ "omitted for char count" ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "value": 0,
              "description": "match on required clause, product of:",
              "details": [
                {
                  "value": 0,
                  "description": "# clause",
                  "details": []
                },
                {
                  "value": 1,
                  "description": "DocValuesFieldExistsQuery [field=_primary_term]",
                  "details": []
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

It appears to only be summing the scores for the matches in each field, not summing them and dividing by the number of match clauses as documented. Is this expected?
I found a similar forum topic with no response.

Additionally, if anyone can explain the match on required clause, product of: part, I would appreciate that too :slight_smile:

I'm using docker image elasticsearch:6.6.0.

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