给定LNG,找到LAT/LNG所在的每个圆圈



我有一个列表geoshape文档:

{
    "location" : {
        "type" : "circle",
        "coordinates" : [-45.0, 45.0],
        "radius" : "8000m"
    }
 }

给出了一个lat/lng,我想找到该lat/lng所在的所有文档。

您需要使用这样的 geo_shape查询:

{
  "query": {
    "bool": {
      "filter": {
        "geo_shape": {
          "location": {
            "shape": {
              "type": "point",
              "coordinates": [ -77.03653, 38.897676 ]   <-- lon/lat to search
            },
            "relation": "contains"                      <-- use the contains relationship
          }
        }
      }
    }
  }
}

coordinates参数中,请确保在纬度之前设置经度,而不是相反(感谢Geojson)

最新更新