ES|QL EMBEDDING function
navigation_title: "EMBEDDING"
value- Value to generate embeddings from. Must be a non-null literal string value. Use data type and format options to specify the content type and format (e.g. plain text, base64-encoded images) of the input.
inference_id- Identifier of an existing inference endpoint that will generate the embeddings. The inference endpoint must have the
embeddingtask type and should use the same model that was used to embed your indexed data. options-
(Optional) Options for the input value.
Generates dense vector embeddings from multimodal input using a specified inference endpoint with the {@code embedding} task type. Use this function to generate query vectors for KNN searches from multimodal inputs against your vectorized data or other dense vector based operations.
| value | inference_id | options | result |
|---|---|---|---|
| keyword | keyword | named parameters | dense_vector |
type- (keyword) Content type of the input (e.g. "text", "image").
timeout-
(keyword) Timeout for the inference request (e.g. "30s", "1m").
Generate embeddings using the 'test_dense_inference' inference endpoint, using the default type and format (text):
FROM dense_vector_text METADATA _score
| EVAL query_embedding = EMBEDDING("be excellent to each other", "test_embedding_inference")
| WHERE KNN(text_embedding_field, query_embedding)
| SORT _score DESC
| LIMIT 10
Generate embeddings using an inference endpoint, specifying the data type:
ROW b64_input="This is an image"
| EVAL embedding = EMBEDDING("data:image/jpeg;base64,VGhpcyBpcyBhbiBpbWFnZQ==", "test_embedding_inference", {"type": "image"})