2017-05-04 32 views
0

我现在有一个ES查询来查找最近的位置为纬度/长:散装几何ES查询

GET /geo/_search 
{ 
    "sort": [ 
     { 
      "_geo_distance": { 
       "geometry": { 
        "lat": 64, 
        "lon": 34 
       }, 
       "order": "asc", 
       "unit": "mi", 
       "distance_type": "plane" 
      } 
     } 
    ], 
    "size": 1 
} 

我希望能够在1个查询多个纬度/多头运行此,这将返回与他们最近的位置相关的每个经纬度。有没有办法做到这一点?

回答

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使用循环