【问题标题】:elasticsearch - score_mode sum don't return expected resutlselasticsearch - score_mode sum 不返回预期结果
【发布时间】:2018-11-15 22:49:08
【问题描述】:

我有一个带有两个衰减函数 (ES 2.4.4) 的查询,我正在使用 "score_mode" : "sum" 对衰减函数的分数 + 查询词的分数求和。对于测试,我使用"boost_mode" : "replace" 来防止任何其他分数(来自查询)影响我的分数(我想测试衰减函数)。

这些是我的衰减函数:

"function_score": { "boost_mode" : "replace", "score_mode" : "sum", "functions": [ { "gauss": { "date": { "scale": "10d", "offset": "15d", "decay": 0.9 } }, "weight" : 400 }, { "gauss": { "priority": { "origin": "5000", "scale": "2000", "decay": 0.9 } }, "weight" : 20 } ]

我的结果包括 2 篇不同日期的文章 (2017-08-28 , 2009-05-08),具有相同的优先级 (1000) 和相同的分数! (13.122) 怎么可能?为什么2017-08-28 没有得到更好的分数? 所以我试图解释这个查询。

2017 年 8 月 28 日:

`"value": 13.122,
              "description": "function score, score mode [sum]",
              "details": [
                {
                  "value": 7.897688e-31,
                  "description": "function score, product of:",
                  "details": [
                    {
                      "value": 1,
                      "description": "match filter: *:*",
                      "details": [

                      ]
                    },
                    { }
                  ]
                },
                {
                  "value": 13.122,
                  "description": "function score, product of:",
                  "details": [
                    {
                      "value": 1,
                      "description": "match filter: *:*",
                      "details": [

                      ]
                    },
                    {
                      "value": 13.122,
                      "description": "product of:",
                      "details": [`

我不明白为什么分数是 13.122 而不是 13.122 + 7.897。 "score_mode" : "sum" 是否有错误或有什么我不明白的地方? 2009-05-08 的另一篇文章的优先级得分为 13.122,日期得分为 0。

注意:我必须使用"score_mode" : "sum",因为我想从每种类型中获得前 10 个结果,并且对于我的某些类型,日期不相关,所以我使用分数为 0 的旧日期,当分数模式设置为相乘时(弹性默认分数模式)由于乘法,我对这种类型的所有分数都返回为 0。

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    该值不是 7.897,而是 7.897688e-31。所以你的总分就是他们的总和,也就是

    13.1220000000000000000000000000000007897688
    

    即 13.122。 :)

    【讨论】:

      猜你喜欢
      • 2021-05-17
      • 2023-03-04
      • 1970-01-01
      • 2016-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-19
      • 1970-01-01
      相关资源
      最近更新 更多