generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestv2.9.0v2.9.0v2.9.0
Description
The purpose of this RFC (request for comments) is to gather community feedback on a proposal to allow OpenSearch users to facilitate Geo Bounds Aggregations over the GeoShape data type. This RFC is in continuation with #84.
Geo Bounds Aggregation
A metric aggregation that computes the bounding box containing all geo values for a field.
Aggregation Schema
{
"aggs/aggregations": {
"<user-provided-aggregation-name>": {
"geo_bounds": {
"field": "<field-name-on-which-aggregation-will-be-performed>",
"wrap_longitude": <true/false> // default value is true
}
}
}
}
Input Parmeters:
- wrap_longitude: It will be an optional parameter which specifies whether the bounding box should be allowed to overlap the international date line. The default value is true. If wrap_longitude is set to true (the default), the bounding box can overlap the international date line and return a bounds where the top_left longitude is larger than the top_right longitude.
Example
Index Creation
PUT /myexample
{
"mappings": {
"properties": {
"geometry": {
"type": "geo_shape"
}
}
}
}
Index Data
POST /myexample/_bulk?refresh
{"index":{"_id":1}}
{"name": "Science Museum", "geometry": "POINT(4.912350 52.374081)" }
{"index":{"_id":2}}
{"name": "MyHouse", "geometry": { "type": "Polygon", "coordinates": [ [ [ 4.965305328369141, 52.39347642069457 ], [ 4.966979026794433, 52.391721758934835 ], [ 4.969425201416015, 52.39238958618537 ], [ 4.967944622039794, 52.39420969150824 ], [ 4.965305328369141, 52.39347642069457 ] ] ] } }
Run Aggregation
POST /myexample/_search?size=0
{
"aggregations": {
"viewport": {
"geo_bounds": {
"field": "geometry",
"wrap_longitude": true
}
}
}
}
Output of Aggregation
{
....
"aggregations": {
"viewport": {
"bounds": {
"top_left": {
"lat": 52.39420966710895,
"lon": 4.912349972873926
},
"bottom_right": {
"lat": 52.374080987647176,
"lon": 4.969425117596984
}
}
}
}
}
Launch Dates
We are working to identify the exact version of OpenSearch in which this aggregation will be launched. Will add the details soon.
References
- GeoBound on Geo Points: https://opensearch.org/docs/latest/opensearch/metric-agg/#geo_bound
- RFC for Aggregations: [RFC] - Implement Aggregations on Geo Shape Field #84
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestv2.9.0v2.9.0v2.9.0