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

ES|QL Support ST_DWITHIN #109985

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

craigtaverner
Copy link
Contributor

@craigtaverner craigtaverner commented Jun 20, 2024

Support for ST_DWITHIN was originally developed as part of the work on ST_DISTANCE for a few reasons:

  • They are conceptually similar, and share some code
  • PostGIS uses this function as the primary way to perform optimized index-backed searches by distance (PostGIS does not optimize ST_DISTANCE against the index, and recommends using ST_DWITHIN). Users coming from PostGIS will expect to find and use this function.
  • We originally though we needed something like this for Lucene pushdown, such that we implement the pushdown of ST_DWITHIN to the existing _search query for geo_distance. Conceptually geo_distance is much closer to ST_DWITHIN than it is to ST_DISTANCE, because the distance value is strongly coupled to the function (as an argument).

However it was argued that we do not really need to implement ST_DWITHIN for a few reasons:

  • We can optimize the pushdown to Lucene by rewriting ST_DISTANCE() < X to a call to ST_INTERSECTS(Circle(X)), which already supports lucene pushdown.
  • Users can achieve all use cases with ST_DISTANCE itself, and do not really need a second function.

This PR captures the work done for ST_DWITHIN if we decide to implement it later.

@craigtaverner craigtaverner added >enhancement :Analytics/Geo Indexing, search aggregations of geo points and shapes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL labels Jun 20, 2024
Copy link

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

Hi @craigtaverner, I've created a changelog YAML for you.

@craigtaverner craigtaverner changed the title Esql st dwithin ES|QL Support ST_DWITHIN Jun 20, 2024
@craigtaverner
Copy link
Contributor Author

@elasticsearchmachine update branch

This was originally done within the ST_DISTANCE PR, but has been extracted into it's own PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL :Analytics/Geo Indexing, search aggregations of geo points and shapes >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants