Geo Bounds Aggregation

edit

Added in 1.3.0.

A metric aggregation that computes the bounding box containing all geo_point values for a field.

Experimental!

This feature is marked as experimental, and may be subject to change in the future. If you use this feature, please let us know your experience with it!

Example:

{
    "query" : {
        "match" : { "business_type" : "shop" }
    },
    "aggs" : {
        "viewport" : {
            "geo_bounds" : {
                "field" : "location" 
                "wrap_longitude" : "true" 
            }
        }
    }
}

The geo_bounds aggregation specifies the field to use to obtain the bounds

wrap_longitude is an optional parameter which specifies whether the bounding box should be allowed to overlap the international date line. The default value is true

The above aggregation demonstrates how one would compute the bounding box of the location field for all documents with a business type of shop

The response for the above aggregation:

{
    ...

    "aggregations": {
        "viewport": {
            "bounds": {
                "top_left": {
                    "lat": 80.45,
                    "lon": -160.22
                },
                "bottom_right": {
                    "lat": 40.65,
                    "lon": 42.57
                }
            }
        }
    }
}