-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[PoC] ESQL - Push down Top N expressions to Lucene #136274
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
[PoC] ESQL - Push down Top N expressions to Lucene #136274
Conversation
…rity-functions # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/vector/VectorSimilarityFunction.java
…ector-similarity-functions
…ector-similarity-functions
…-similarity-functions' into non-issue/esql-push-vector-similarity-functions
🔍 Preview links for changed docs |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
Closing, as we will use |
Not being able to push down vector similarity functions as scripts to Lucene harms performance, as vector fields have to be deserialized in order for similarities to be calculated on the compute engine.
This PoC pushes down TopN expressions to Lucene, translating them to sort scripts. We're using sort scripts, as:
Expressions define two new methods:
getPushableOptions
: Returns whether the expression is pushable to Lucene:PREFERRED
: We should push whenever possible. An expression that has aPREFERRED
expression and does not have aNOT_SUPPORTED
one can be pushed down to Lucene.SUPPORTED
: Expression can be pushed down but does not offer a significant advantage in terms of performance, or depends on other expressions that are part of it.NOT_SUPPORTED
: Expression can't be pushed down.asScript
: Returns a String with the Painless script to use as an expression translation into Painless.The
PushTopNToSource
optimization rule is modified to add a script sort to theEsQueryExec
in case a pushable expression is found for a Top N.The
LuceneTopNSourceOperator
retrieves the sort values for the script sorts, so they are usable on the compute engine as the result of the evaluation.