elasticsearch中的function_score查询不会改变分数

时间:2016-04-14 10:55:25

标签: elasticsearch solr-boost

我的索引包含以下doc结构:公司>工作(嵌套)

公司有名称和工作有地址。我默认按地址搜索作业。除此之外,我还尝试使用function_score查询按名称推广某些公司。但我的询问似乎并没有增加任何东西或改变分数。

{
  "query": {
    "filtered": {
      "filter": {},
      "query": {
        "function_score": {
          "query": {
            "nested": {
              "path": "active_jobs",
              "score_mode": "max",
              "query": {
                "multi_match": {
                  "query": "United States",
                  "type": "cross_fields",
                  "fields": [
                    "active_jobs.address.city",
                    "active_jobs.address.country",
                    "active_jobs.address.state"
                  ]
                }
              },
              "inner_hits": {
                "size": 1000
              }
            }
          },
          "functions": [
            {
              "filter": {
                "term": {
                  "name": "Amazon"
                }
              },
              "weight": 100
            }
          ]
        }
      }
    }
  },
  "size": 30,
  "from": 0
}

[更新1] 以下是active_jobs属性的映射:

    "active_jobs": {
  "type": "nested",
  "properties": {
    "active": {
      "type": "boolean"
    },
    "address": {
      "properties": {
        "city": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "state_code": {
          "type": "string"
        }
      }
    },
    "id": {
      "type": "long"
    },
    "title": {
      "type": "string"
    },
    "updated_at": {
      "type": "date",
      "format": "dateOptionalTime"
    }
  }
}

0 个答案:

没有答案
相关问题