如何在OpenSearch中过滤多个字段以及geo_distance
我目前有一个弹性搜索查询,该查询仅根据具有地理距离的KM半径过滤。我想搜索多个字段以及地理距离过滤器。
这是我的查询:
{
"query": {
"bool": {
"filter": {
"geo_distance": {
"distance": "5km",
"coordinate": {
"lat": 3.131779652034938,
"lon": 101.6846340901202
}
}
}
}
}
}
这是我从Elatic-search获得的回复:
{
"took": 17,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 11,
"relation": "eq"
},
"max_score": 0.0,
"hits": [
{
"_index": "drivers",
"_id": "Oj07uYEBZP3C5zS1xL7e",
"_score": 0.0,
"_source": {
"id": 1,
"name": "Dwayne Johnson",
"area": "Brick Fields",
"coordinate": {
"lat": 3.130143699375071,
"lon": 101.68389642814743
},
"vehicles": [
{
"vehicle_type": "Car",
"weight_capacity": "500",
"vehicle_number": "WM3219"
},
{
"vehicle_type": "Large Truck",
"weight_capacity": "1000",
"vehicle_number": "VAV3234"
}
],
"deposit": "1500"
}
}]
}
}
我想使用弹性搜索查询过滤存款从驱动程序对象和geo-Distance进行过滤。任何人都可以帮我查询吗?
I have a elastic-search query currently which only filters based on km radius with geo-distance. I want to search multiple fields along with geo-distance filter.
here is my query:
{
"query": {
"bool": {
"filter": {
"geo_distance": {
"distance": "5km",
"coordinate": {
"lat": 3.131779652034938,
"lon": 101.6846340901202
}
}
}
}
}
}
Here is reponse i got from elatic-search:
{
"took": 17,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 11,
"relation": "eq"
},
"max_score": 0.0,
"hits": [
{
"_index": "drivers",
"_id": "Oj07uYEBZP3C5zS1xL7e",
"_score": 0.0,
"_source": {
"id": 1,
"name": "Dwayne Johnson",
"area": "Brick Fields",
"coordinate": {
"lat": 3.130143699375071,
"lon": 101.68389642814743
},
"vehicles": [
{
"vehicle_type": "Car",
"weight_capacity": "500",
"vehicle_number": "WM3219"
},
{
"vehicle_type": "Large Truck",
"weight_capacity": "1000",
"vehicle_number": "VAV3234"
}
],
"deposit": "1500"
}
}]
}
}
I want to filter deposit value from driver object along with geo-distance using elastic search query. Can anyone please help me with the query.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想从问题中了解其他过滤器
If you want an additional filter as I understand from the question