Skip to content

score and explanation for dfs queries don't match  #15369

@brwe

Description

@brwe

Tested 1.7 vs 2.1. The following example:

POST test/doc/1
{
  "text": "Score and explanation should match I think?"
}

POST test/doc/2
{
  "text": "Score and explanation did match in 1.7..."
}


GET test/_search?search_type=dfs_query_then_fetch&explain
{
  "query": {
    "match": {
      "text": "score"
    }
  }
}

for 1.7.0 returns:

{
   "took": 48,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 2,
      "max_score": 0.22295055,
      "hits": [
         {
            "_shard": 2,
            "_node": "5IoTIXdmROKObfLRmqCQYQ",
            "_index": "test",
            "_type": "doc",
            "_id": "1",
            "_score": 0.22295055,
            "_source": {
               "text": "Score and explanation should match I think?"
            },
            "_explanation": {
               "value": 0.22295056,
               "description": "weight(text:score in 0) [PerFieldSimilarity], result of:",
               "details": [
                  {
                     "value": 0.22295056,
                     "description": "score(doc=0,freq=1.0), product of:",
                     "details": ```
         {
            "_shard": 2,
            "_node": "8AbQaexnTwKbvcL1Va4yfw",
            "_index": "test",
            "_type": "doc",
            "_id": "1",
            "_score": 0.22295055,
            "_source": {
               "text": "Score and explanation should match I think?"
            },
            "_explanation": {
               "value": 0.22295056,
               "description": "weight(text:score in 0) [PerFieldSimilarity], result of:",[
                        {
                           "value": 0.99999994,
                           "description": "queryWeight, product of:",
                           "details": [
                              {
                                 "value": 0.5945349,
                                 "description": "idf(docFreq=2, maxDocs=2)"
                              },
                              {
                                 "value": 1.681987,
                                 "description": "queryNorm"
                              }
                           ]
                        },
                        {
                           "value": 0.22295058,
                           "description": "fieldWeight in 0, product of:",
                           "details": [
                              {
                                 "value": 1,
                                 "description": "tf(freq=1.0), with freq of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "termFreq=1.0"
                                    }
                                 ]
                              },
                              {
                                 "value": 0.5945349,
                                 "description": "idf(docFreq=2, maxDocs=2)"
                              },
                              {
                                 "value": 0.375,
                                 "description": "fieldNorm(doc=0)"
                              }
                           ]
                        }
                     ]
                  }
               ]
            }
         },
         {
            "_shard": 3,
            "_node": "5IoTIXdmROKObfLRmqCQYQ",
            "_index": "test",
            "_type": "doc",
            "_id": "2",
            "_score": 0.22295055,
            "_source": {
               "text": "Score and explanation did match in 1.7..."
            },
            "_explanation": {
               "value": 0.22295056,
               "description": "weight(text:score in 0) [PerFieldSimilarity], result of:",
               "details": [
                  {
                     "value": 0.22295056,
                     "description": "score(doc=0,freq=1.0), product of:",
                     "details": [
                        {
                           "value": 0.99999994,
                           "description": "queryWeight, product of:",
                           "details": [
                              {
                                 "value": 0.5945349,
                                 "description": "idf(docFreq=2, maxDocs=2)"
                              },
                              {
                                 "value": 1.681987,
                                 "description": "queryNorm"
                              }
                           ]
                        },
                        {
                           "value": 0.22295058,
                           "description": "fieldWeight in 0, product of:",
                           "details": [
                              {
                                 "value": 1,
                                 "description": "tf(freq=1.0), with freq of:",
                                 "details": [
                                    {
                                       "value": 1,
                                       "description": "termFreq=1.0"
                                    }
                                 ]
                              },
                              {
                                 "value": 0.5945349,
                                 "description": "idf(docFreq=2, maxDocs=2)"
                              },
                              {
                                 "value": 0.375,
                                 "description": "fieldNorm(doc=0)"
                              }
                           ]
                        }
                     ]
                  }
               ]
            }
         }
      ]
   }
}

and in 2.1:

{
   "took": 46,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 2,
      "max_score": 0.22295055,
      "hits": [
         {
            "_shard": 2,
            "_node": "hcC0CtAfTSSILbEq32T_fw",
            "_index": "test",
            "_type": "doc",
            "_id": "2",
            "_score": 0.22295055,
            "_source": {
               "text": "Score and explanation did match in 1.7..."
            },
            "_explanation": {
               "value": 0.11506981,
               "description": "weight(text:score in 0) [PerFieldSimilarity], result of:",
               "details": [
                  {
                     "value": 0.11506981,
                     "description": "fieldWeight in 0, product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "tf(freq=1.0), with freq of:",
                           "details": [
                              {
                                 "value": 1,
                                 "description": "termFreq=1.0",
                                 "details": []
                              }
                           ]
                        },
                        {
                           "value": 0.30685282,
                           "description": "idf(docFreq=1, maxDocs=1)",
                           "details": []
                        },
                        {
                           "value": 0.375,
                           "description": "fieldNorm(doc=0)",
                           "details": []
                        }
                     ]
                  }
               ]
            }
         },
         {
            "_shard": 3,
            "_node": "hcC0CtAfTSSILbEq32T_fw",
            "_index": "test",
            "_type": "doc",
            "_id": "1",
            "_score": 0.22295055,
            "_source": {
               "text": "Score and explanation should match I think?"
            },
            "_explanation": {
               "value": 0.11506981,
               "description": "weight(text:score in 0) [PerFieldSimilarity], result of:",
               "details": [
                  {
                     "value": 0.11506981,
                     "description": "fieldWeight in 0, product of:",
                     "details": [
                        {
                           "value": 1,
                           "description": "tf(freq=1.0), with freq of:",
                           "details": [
                              {
                                 "value": 1,
                                 "description": "termFreq=1.0",
                                 "details": []
                              }
                           ]
                        },
                        {
                           "value": 0.30685282,
                           "description": "idf(docFreq=1, maxDocs=1)",
                           "details": []
                        },
                        {
                           "value": 0.375,
                           "description": "fieldNorm(doc=0)",
                           "details": []
                        }
                     ]
                  }
               ]
            }
         }
      ]
   }
}

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions