1.6到2.3之间的不同分数

时间:2016-06-13 06:33:31

标签: elasticsearch

我正在将弹性版本从1.6升级到2.3,不幸的是我看到完全相同查询的评分机制发生了重大变化,这是否已知?

以下是解释:

弹性1.6:

    {
      "value": 0.2062798,
      "description": "ConstantScore(tags: \u0001\u0000\u0000\u0000\u0000\u0000\u00058o>)^79.65, product of:",
      "details": [{
        "value": 79.65,
        "description": "boost"
      }, {
        "value": 0.0025898279,
        "description": "queryNorm"
      }]
    }

弹性2.3:

    {
      "value": 3.2230546,
      "description": "weight(tags: \u0001\u0000\u0000\u0000\u0000\u0000\u00058o> in 9071) [PerFieldSimilarity], result of:",
      "details": [{
        "value": 3.2230546,
        "description": "score(doc=9071,freq=1.0), product of:",
        "details": [{
          "value": 0.2972071,`enter code here`
          "description": "queryWeight, product of:",
          "details": [{
            "value": 79.65,
            "description": "boost",
            "details": []
          }, {
            "value": 10.844475,
            "description": "idf(docFreq=119, maxDocs=2262468)",
            "details": []
          }, {
            "value": 0.00034408428,
            "description": "queryNorm",
            "details": []
          }]
        }, {
          "value": 10.844475,
          "description": "fieldWeight in 9071, product of:",
          "details": [{
            "value": 1,
            "description": "tf(freq=1.0), with freq of:",
            "details": [{
              "value": 1,
              "description": "termFreq=1.0",
              "details": []
            }]
          }, {
            "value": 10.844475,
            "description": "idf(docFreq=119, maxDocs=2262468)",
            "details": []
          }, {
            "value": 1,
            "description": "fieldNorm(doc=9071)",
            "details": []
          }]
        }]
      }]
    }

以下是我使用的查询:

{
"query": {
      "bool": {
         "should": [
            {
               "bool": {
                  "should": [
                     {
                        "constant_score": {
                           "filter": {
                              "terms": {
                                 "path": [
                                    "1489",
                                    "1456",
                                    "10125",
                                    "11498",
                                    "11264",
                                    "12987",
                                    "12156"
                                 ]
                              }
                           },
                           "boost": 150
                        }
                     },
                     {
                        "bool": {
                           "should": [
                              {
                                 "term": {
                                    "path": {
                                       "value": "1389",
                                       "boost": 11
                                    }
                                 }
                              },
                              {
                                 "term": {
                                    "path": {
                                       "value": "31016",
                                       "boost": 19.8
                                    }
                                 }
                              },
                              {
                                 "term": {
                                    "path": {
                                       "value": "31153",
                                       "boost": 237.4
                                    }
                                 }
                              }
                           ],
                           "disable_coord": true
                        }
                     }
                  ],
                  "disable_coord": true
               }
            }
         ]
      }
   }
}

1 个答案:

答案 0 :(得分:0)

事实证明,弹性确实改变了行为,对数字字段的查询曾经是自动的常数分数。 从2.x起使用tf / idf。

在版本5中,它应该回到恒定分数。