elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.41k stars 24.56k forks source link

Shape-related Painless functions #36439

Open Destroy666x opened 5 years ago

Destroy666x commented 5 years ago

Describe the feature: It would be nice to have some scripting functions for shape-related checks - like if the document's shape intersects a shape passed as an argument or if a point is within a shape.

elasticmachine commented 5 years ago

Pinging @elastic/es-analytics-geo

imotov commented 5 years ago

In what context would such functions be used?

Destroy666x commented 5 years ago

Custom scripts e.g. to obtain score for area detection.

imotov commented 5 years ago

That might be quite inefficient unless we add doc values support support for geo_shapes, which is something we would like to do for other reasons. So, we should probably revisit this after #32039.

imotov commented 5 years ago

Depends on #37206

nknize commented 4 years ago

This is definitely something we want to be able to support in the future as it adds value to Geo SQL. There are still quite a few dependencies and unknowns, however, that need to be addressed before we can begin listing out and planning those ST_ functions we want to / can support:

  1. geo_shape doc values is now supported, but we don't yet have a way of recreating the shape to begin computing geometry attributes (e.g., area, perimeter, overlap)
  2. we currently only support WGS84 decimal degrees (which means area calculations will be incorrectly computed in decDegress^2); there is an open issue to add support for alternative projections, which will need to be supported to correctly compute area
  3. We are currently working on other features that could make this doable and more efficient, but they are still a ways away before we can start addressing this feature.

I am marking this as high hanging fruit and converting into a meta issue so we can start tracking the dependencies, and progress.

In the meantime, it would be useful to start listing those functions that are of most interest to our user base. I'll start: