Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] - Geo Bound Aggregation on Geo Shape Field #93

Closed
navneet1v opened this issue Jul 14, 2022 · 1 comment
Closed

[RFC] - Geo Bound Aggregation on Geo Shape Field #93

navneet1v opened this issue Jul 14, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request v2.9.0 v2.9.0

Comments

@navneet1v
Copy link
Collaborator

navneet1v commented Jul 14, 2022

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

  1. GeoBound on Geo Points: https://opensearch.org/docs/latest/opensearch/metric-agg/#geo_bound
  2. RFC for Aggregations: [RFC] - Implement Aggregations on Geo Shape Field #84
@navneet1v navneet1v added the enhancement New feature or request label Jul 14, 2022
@navneet1v navneet1v self-assigned this Jul 14, 2022
@navneet1v navneet1v changed the title [RFC] - Implement Geo Bound Aggregation on Geo Shape Field [RFC] - Geo Bound Aggregation on Geo Shape Field Jul 14, 2022
@vamshin vamshin added v2.5.0 'Issues and PRs related to version v2.5.0' roadmap documentation Improvements or additions to documentation and removed roadmap labels Jul 22, 2022
@navneet1v navneet1v added v2.6.0 and removed v2.5.0 'Issues and PRs related to version v2.5.0' labels Jan 10, 2023
@VijayanB VijayanB removed the v2.6.0 label Feb 22, 2023
@navneet1v navneet1v added the v2.9.0 v2.9.0 label Jul 7, 2023
@navneet1v
Copy link
Collaborator Author

Closing this RFC as the code is merged to 2.9 branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request v2.9.0 v2.9.0
Projects
None yet
Development

No branches or pull requests

3 participants