Type to search.

ES|QL EMBEDDING function

Serverless Preview

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Preview

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack Preview 9.5+

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Preview since 9.5

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Generates dense vector embeddings from multimodal input using an inference endpoint.

Embedded
Embedded
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 embedding task 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 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
keyword keyword 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):

ES|QL
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:

ES|QL
ROW b64_input="This is an image"
| EVAL embedding = EMBEDDING("data:image/jpeg;base64,VGhpcyBpcyBhbiBpbWFnZQ==", "test_embedding_inference", {"type": "image"})