Elasticsearch脚本得分和衰减函数得分不会成倍增加

时间:2014-12-15 21:46:34

标签: elasticsearch elasticsearch-plugin

"query": {
    "function_score": {
        "filter" : {
            "bool" : {
                "must" : [
                    { "terms" : { "content" : "test"} }
                ]
            }

        },
        "functions": [{
            "exp": {
                "date": {
                      "origin": "now",
                      "scale": "1d",
                      "decay" : 0.05
                }
            },
            "script_score": {
                "script": "_score * 10",
                "lang":"groovy"
            }   
        }],
        "score_mode": "multiply"
    }
}}

"功能"分数不会成倍增加。分数仅使用最后一项功能计算。 如果我交换地点" exp"使用" script_score"," exp"分数将显示。 问题是什么? 注意:" script_score"只是一个虚拟的功能。

1 个答案:

答案 0 :(得分:0)

我的查询错了,应该是:

{"exp": {
    "date": {
          "origin": "now",
          "scale": "1d",
          "decay" : 0.05
    }
}},
{"script_score": {
    "script": "_score * 10",
    "lang":"groovy"
}}