0

我有一个具有以下文档结构的索引:Company > Jobs (nested)

公司有名称,职位有地址。我默认按地址搜索工作。除此之外,我正在尝试使用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"
    }
  }
}
4

0 回答 0