You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Geo Polygon Queryedit
A query allowing to include hits that only fall within a polygon of points. Here is an example:
{ "bool" : { "query" : { "match_all" : {} }, "filter" : { "geo_polygon" : { "person.location" : { "points" : [ {"lat" : 40, "lon" : -70}, {"lat" : 30, "lon" : -80}, {"lat" : 20, "lon" : -90} ] } } } } }
Query Optionsedit
Option | Description |
---|---|
| Optional name field to identify the filter |
| Set to |
| Set to |
Allowed Formatsedit
Lat Long as Arrayedit
Format in [lon, lat]
, note, the order of lon/lat here in order to
conform with GeoJSON.
{ "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_polygon" : { "person.location" : { "points" : [ [-70, 40], [-80, 30], [-90, 20] ] } } } } }
Lat Lon as Stringedit
Format in lat,lon
.
{ "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_polygon" : { "person.location" : { "points" : [ "40, -70", "30, -80", "20, -90" ] } } } } }
Geohashedit
{ "bool" : { "must" : { "match_all" : {} }, "filter" : { "geo_polygon" : { "person.location" : { "points" : [ "drn5x1g8cu2y", "30, -80", "20, -90" ] } } } } }
geo_point Typeedit
The query requires the geo_point
type to be set on the
relevant field.