我目前有一个ES查询来查找最接近纬度/经度的位置:
GET /geo/_search
{
"sort": [
{
"_geo_distance": {
"geometry": {
"lat": 64,
"lon": 34
},
"order": "asc",
"unit": "mi",
"distance_type": "plane"
}
}
],
"size": 1
}
我希望能够在1个查询中运行多个纬度/长度,这将返回与其最近位置相关的每个纬度/经度。有没有办法做到这一点?
答案 0 :(得分:0)
GET /geo/_search
{
"sort": [
{
"_geo_distance": {
"geometry": [
{
"lat": 64,
"lon": 34
},
{
"lat": 0,
"lon": 0
}
],
"order": "asc",
"unit": "mi",
"distance_type": "plane"
}
}
],
"size": 1
}
这个答案为每个geo_point提供了多个点。我不认为你可以在一个查询中只检索每个geo_point的前一个。您可能需要过滤结果或为每个geo_point使用循环