0

次のようなジオシェイプ ドキュメントのリストがあります。

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

緯度/経度が与えられた場合、この緯度/経度が含まれているすべてのドキュメントを検索したいと考えています。

4

1 に答える 1

2

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 に感謝)

于 2016-11-24T13:26:21.253 に答える