Can not query geo_point using geo polygon filter

920 Views Asked by At

Hi I'm trying to query geo_point in ElasticSearch, using the query syntax geo polygon filter in the official document], but no reusult is returned. geo pologon filter no result

Here are some details: I use river plugin to index the data from MySQL into ES with the definition of mapping (a nested structure but coordinate.value is geo_point).

geo_point mapping definition

I can see the documents from head plugin:

ElasticSearch document

The query json is:

{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "geo_polygon": {
          "coordinate.value": {
            "points": [
              [
                -180,
                90
              ],
              [
                -180,
                -90
              ],
              [
                180,
                -90
              ],
              [
                -180,
                90
              ]
            ]
          }
        }
      }
    }
  }
}

Can anyone tell me what's the correct query method to get geo_point? Thanks

1

There are 1 best solutions below

1
On

polygon should be closed (ie first and last points should be the same).