【发布时间】:2020-06-01 15:36:47
【问题描述】:
我有如下索引映射:
请求
|-> tilte
|-> countryCode
|-> isOpen
|-> location
|-> date
我想同时进行 bool 和 geoquery 获取在同一个国家和我附近的文档,isOpen 我已经尝试了以下但总是我得到一个空的 hits 对象。
{ "from" : 5,
"size": 5,
"query": {
"bool" : {
"must" : [
{"match" : {"countryCode": "US"}},
{"match": {"isOpen": true }}
],
"filter" : {
"geo_distance" : {
"distance" : "150km",
"location" : {
"lat" : 1111111111,
"lon" : 3333333333
}
}
}
}
},
"sort": [ { "date" : {"order" : "desc"} } ]
}
回应
{
"took": 8,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
即使我确定有很多文档与查询匹配,但我无法得到它。有谁可以帮忙?
【问题讨论】:
标签: elasticsearch elastic-stack elasticsearch-5