3

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

Wei Lin
  • 749
  • 2
  • 6
  • 9

1 Answers1

1

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

user1028697
  • 135
  • 1
  • 8
  • You sir are the absolute hero! Just to make a short extension on this. If you are getting the coordinates from google maps for example, be sure to have the coordinates in order. For example (nw, ne, se, sw, nw). ElasticSearch is innacurate if not – Borjante May 03 '18 at 17:10