-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Open
Labels
:Search Relevance/SearchCatch all for Search RelevanceCatch all for Search RelevanceMetaTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearchv9.2.0
Description
meta issue: #123043
Summary
Add a new TEXT_EMBEDDING
function to ES|QL that generates dense vector embeddings for text using a specified inference model.
Motivation
Enable users to generate text embeddings directly in their ES|QL queries, which is essential for semantic search, similarity search, and other vector operations without requiring a separate ETL step.
Basic Example
FROM documents
| WHERE KNN(embedding_field, TEXT_EMBEDDING(content, "all-MiniLM-L6-v2"), 10)
Detailed Design
Function Signature
TEXT_EMBEDDING(text: string, inference_id: string) -> dense_vector
Parameters
text
: The input text to embed (string literal or column reference)inference_id
: The ID of the inference model to use (string literal)
Behavior
- Validates that both parameters are provided and of the correct type
- Loads the specified inference model using the inference service
- Generates a dense vector embedding for the input text
- Returns the embedding as a
dense_vector
type
Error Cases
- Returns an error if the inference model is not found
- Returns an error if the model fails to generate an embedding
- Returns an error if the input text is null or empty
Related Issues
- ES|QL - dense_vector approximate nearest neighbour search support #126710 - ES|QL: Add support for KNN function
- ES|QL dense vector support #125783 - ES|QL: Add support for dense_vector type
TODO List
Done:
- Proof of concept PR: [DRAFT] ESQL: Add TEXT_EMBEDDING function for dense vector embeddings #131131
- ESQL: Add asynchronous pre-optimization step for logical plan #131440
WIP
- Refactored the ES|QL inference runner to allow both single request and batch (ES|QL Inference runner refactoring #131986)
- Improve inference resolution so it works with InferencePlan and InferenceFunction
Not started
- Final implementation
- Doc
- Pull out of snapshot build
- Kibana integration / autocomplete
Metadata
Metadata
Assignees
Labels
:Search Relevance/SearchCatch all for Search RelevanceCatch all for Search RelevanceMetaTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearchv9.2.0