ESQL - TO_DENSE_VECTOR function and additional casting#134003
ESQL - TO_DENSE_VECTOR function and additional casting#134003carlosdelest merged 35 commits intoelastic:mainfrom
Conversation
…literal translation is done
…r-casting' into non-issue/esql-dense-vector-casting # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToDenseVector.java
🔍 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?
|
…e for checking which args to convert
…vector-casting # Conflicts: # x-pack/plugin/esql/qa/testFixtures/src/main/resources/knn-function.csv-spec # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
kderusso
left a comment
There was a problem hiding this comment.
Changes look good to me, nice work!
tteofili
left a comment
There was a problem hiding this comment.
nice work Carlos, LGTM!
| Source source, | ||
| @Param( | ||
| name = "field", | ||
| type = { "double", "long", "integer", "keyword" }, |
There was a problem hiding this comment.
Should we add text as well (if it is loaded from an ES text field)?
There was a problem hiding this comment.
I would say no - it's ok to allow for hex string constants, but I don't think they should be analyzed in any way or retrieved from an analyzed field.
If any time this is needed, they can be converted via the ::keyword casting operator.
…r-casting' into non-issue/esql-dense-vector-casting
…r-casting' into non-issue/esql-dense-vector-casting
…vector-casting # Conflicts: # x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java
Adds a TO_DENSE_VECTOR conversion function to convert to dense_vectors:
Also, performs automatic conversion of vector values for
VectorFunctioninstances on theAnalyzer:or
The Analyzer will convert automatically keyword fields via
castStringLiteral, and add aTO_DENSE_VECTORfunction for numeric values.In order to use a reference attribute for a vector function, we need to use TO_DENSE_VECTOR explicitly, just like other types like IP:
For now, hex strings gets translated to byte dense_vectors. We can create a follow up function TO_BIT_DENSE_VECTOR for using hex strings for bit vectors, or add an optional parameter to TO_DENSE_VECTOR.