2

I've an index with Polygons of countries and what I want to do is to calculate given some coordinates, to witch country belongs.

I've tried in a lot of ways and I get always all my index as a result. It is even posible to do that with elasticsearch?

This is my mapping (summarized to show only the interesting part for this question):

{
  properties: {
    geometry: { 'type': 'geo_shape' }
  }
}

This is the last query that I've tried:

{
  "query":{
     "bool":{
        "must":{
           "match_all":{

           }
        },
        "filter":{
           "geo_shape":{
              "geometry":{
                 "shape":{
                    "type":"point",
                    "coordinates":[
                       2.217779,
                       41.398349
                    ]
                 },
                 "relation":"intersects"
              }
           }
        }
     }
  }
}

More information:

  • My field geometry only can be Polygon or MultiPolygon
  • All the points that I want to use to search after I have them in Geojson format (but of course I can transform it to any format if needed)
  • Can you show the query you're sending? – Val Jun 7 at 12:04
  • @Val question edited – emilioriosvz Jun 11 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.