OpenSearch/docs/reference/search/aggregations/metrics/geobounds-aggregation.asciidoc
Colin Goodheart-Smithe b9f4d44b14 Aggregations: Adds GeoBounds Aggregation
The GeoBounds Aggregation is a new single bucket aggregation which outputs the coordinates of a bounding box containing all the points from all the documents passed to the aggregation as well as the doc count. Geobound Aggregation also use a wrap_logitude parameter which specifies whether the resulting bounding box is permitted to overlap the international date line.  This option defaults to true.

This aggregation introduces the idea of MetricsAggregation which do not return double values and cannot be used for sorting.  The existing MetricsAggregation has been renamed to NumericMetricsAggregation and is a subclass of MetricsAggregation.  MetricsAggregations do not store doc counts and do not support child aggregations.

Closes #5634
2014-06-03 15:59:56 +01:00

62 lines
1.6 KiB
Plaintext

[[search-aggregations-metrics-geobounds-aggregation]]
=== Geo Bounds Aggregation
coming[1.3.0]
A metric aggregation that computes the bounding box containing all geo_point values for a field.
.Experimental!
[IMPORTANT]
=====
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:
[source,js]
--------------------------------------------------
{
"query" : {
"match" : { "business_type" : "shop" }
},
"aggs" : {
"viewport" : {
"geo_bounds" : {
"field" : "location" <1>
"wrap_longitude" : "true" <2>
}
}
}
}
--------------------------------------------------
<1> The `geo_bounds` aggregation specifies the field to use to obtain the bounds
<2> `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:
[source,js]
--------------------------------------------------
{
...
"aggregations": {
"viewport": {
"bounds": {
"top_left": {
"lat": 80.45,
"lon": -160.22
},
"bottom_right": {
"lat": 40.65,
"lon": 42.57
}
}
}
}
}
--------------------------------------------------