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

Implement lucene pushdown on ST_DISTANCE #110102

Merged
merged 5 commits into from
Jun 25, 2024

Conversation

craigtaverner
Copy link
Contributor

@craigtaverner craigtaverner commented Jun 24, 2024

#108764 created the distance function, but without lucene pushdown to geo_distance, this will be slow.

This PR implemented this in a similar way to geo_distance. That code uses the GeoDistanceQueryBuilder to create a lucene query for spatial intersection with a Circle geometry. This PR does a similar thing, but by creating an instance of the SpatialIntersects function, which itself is optimized down to lucene using a similar spatial intersection.

Benchmark results for 90th percentile latency:

branch task value unit
main distanceFilter 9.06487 ms
main distanceFilter-esql 33.0614 ms
st_distance_pushdown distanceFilter 8.97413 ms
st_distance_pushdown distanceFilter-esql 5.55073 ms

Fixes #109972

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

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @craigtaverner, I've updated the changelog YAML for you.

Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iverase
Copy link
Contributor

iverase commented Jun 25, 2024

One thing I am missing is that we are not quantizing our data in the current implementation. I would expect that the test will be flacky when comparing the results?

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.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Lucene push-down for distance filtering with ST_DISTANCE
3 participants