Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

Geo Bounds Aggregation

More info about geo bounds aggregation is in the official elasticsearch docs

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

Simple example

{
    "aggregations" : {
        "agg_viewport" : {
            "geo_bounds" : {
                "field" : "location",
                "wrap_longitude" : true
            }
        }
    }
}

And now the query via DSL:

$geoBoundsAggregation = new GeoBoundsAggregation('viewport', 'location');

$search = new Search();
$search->addAggregation($geoBoundsAggregation);

$queryArray = $search->toArray();