弹性Function_Score无法正确应用

时间:2019-02-25 18:14:56

标签: elasticsearch

致力于弹性搜索6.5.3。我正在使用function_score来更改特定结果的权重。我期望输出的结果是权重最高的结果,然后是其余的。以下是我的查询

GET www-test-index/_search
{
  "query": {
    "function_score": {
      "query": {
        "multi_match": {
          "operator": "and",
          "query": "foo",
          "fields": [
            "title^10",
            "content^5"
          ]
        }
      },
      "functions": [
        {
          "filter": {
            "match": {
              "url": "https://www-somesite/sports/first"
            }
          },

          "weight": 50
        },
        {
          "filter": {
            "match": {
              "url": "https://www-somesite/sports/second"
            }
          },

          "weight": 49
        }
      ],
      "max_boost": 42,
      "score_mode": "sum",
      "boost_mode": "multiply",
      "min_score": 42
    }
  }
}

当我运行上面的查询时,带有https://www-somesite/sports/second的结果显示为第一位,随后是https://www-somesite/sports/first。一开始我很困惑如何获得https://www-somesite/sports/first

0 个答案:

没有答案