我的索引映射如下:
请求
|-> tilte
|-> countryCode
|-> isOpen
|-> location
|-> date
[我想同时制作bool和geoquery,以获取同一国家/地区和我附近的文档,以及isOpen
我曾尝试以下操作,但始终会得到一个空的匹配对象。
{ "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": []
}
}
即使我确定有很多文档与查询匹配,但我无法得到它。有人可以帮忙吗?
我将从from
值从5更改为0开始。接下来,我将检查索引定义-您确定可以以使用方式搜索每个字段吗?您可以显示精确的索引定义(映射)并显示来自Elastic的样本项目吗?