0
"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”只是一个虚拟函数。

4

1 回答 1

0

我的查询错了,应该是:

{"exp": {
    "date": {
          "origin": "now",
          "scale": "1d",
          "decay" : 0.05
    }
}},
{"script_score": {
    "script": "_score * 10",
    "lang":"groovy"
}}
于 2014-12-16T08:38:35.247 回答