The Using the geo_bounding_box query recipe shows how to filter the square section, which is the most common case; Elasticsearch provides a way to filter user-defined polygonal shapes using the geo_polygon filter. This query is useful if the polygon represents a country or region, or a district shape.
Using the geo_polygon query
Getting ready
You need an up and running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
To execute these commands, I suggest using the Kibana console, as this provides code completion, code formatting, and better character escaping for Elasticsearch.
To correctly execute the following commands, you will...