【发布时间】:2021-08-23 16:57:58
【问题描述】:
我在 ES 7.14 中使用两个过滤器创建 constant_score 查询时遇到问题。我的查询是:
"query": {
"constant_score": {
"filters": [
{"exists": {"field": "_geopoint"}},
{"term": {"project_id": "123"}},
]
}
},
基本上,对于 project_id = '123',我需要文档在 _geopoint 中具有任何值的分数。但我得到了错误:
意外的令牌 [START_ARRAY]
我的映射是:
"mappings": {
"properties": {
"project_id": {"type": "keyword"},
"form_id": {"type": "keyword"},
"submission_id": {"type": "keyword"},
"_submitted_date": {"type": "date"},
"_xform_id_string": {"type": "keyword"},
"_submitted_by": {"type": "keyword"},
"_user_id": {"type": "keyword"},
"_project_code": {"type": "keyword"},
"_geopoint": {"type": "text"},
"_geolocation": {"type": "geo_point"},
}
},
我也尝试了一个和:
"filter": {
"and": {
"filters": [
{"exists": {
"field": "_geopoint"
}},
{"term": {
"project_id": "123"
}}
]
}
}
但是我遇到了“和”的问题
任何想法都值得赞赏。 constant_score 的官方文档只有一个过滤器
【问题讨论】:
标签: elasticsearch elasticsearch-query