Perform dense embedding inference on the service
- POST /_inference/embedding/{inference_id}
Required privileges
- Cluster privileges monitor_inference
Request body
-
inputunion oneOfrequired -
Inference input. Either a string, an array of strings, a
contentobject, or an array ofcontentobjects.contentobjects may contain a single item or an array of items. Models that support multiple items percontentobject will return a single embedding for eachcontentobject, regardless of how many items it contains. Support for multiple items in a singlecontentobject is available in Elasticsearch 9.5.0 and later.string example:
"input": "Some text"string array example:
"input": ["Some text", "Some more text"]contentobject example:"input": { "content": { "type": "image", "format": "base64", "value": "data:image/jpeg;base64,..." } }contentobject array example:"input": [ { "content": { "type": "text", "format": "text", "value": "Some text to generate an embedding" } }, { "content": { "type": "image", "format": "base64", "value": "data:image/jpeg;base64,..." } } ]contentobject using theurlformat example (available in Elasticsearch 9.6.0 and later):"input": { "content": { "type": "image", "format": "url", "value": "https://example.com/image.jpg" } }Multiple items in one
contentobject example (available in Elasticsearch 9.5.0 and later):"input": [ { "content": [ { "type": "image", "format": "base64", "value": "data:image/jpeg;base64,..." }, { "type": "text", "value": "Some text to create an embedding" } ] } ] - One of:
-
contentunion oneOfrequired -
An object or an array of objects containing the input data for the model to embed
-
objectorobject[] -
typeenumrequired -
The type of input to embed. Not all models support all input types. The
audio,video, andpdftypes are available in Elasticsearch 9.5.0 and later. -
Values:
textimageaudiovideopdf -
formatenum -
The format of the input. For the
texttype this must betext. For all other types, this must bebase64orurl. If not specified, this will default totextfor thetexttype andbase64for all other types. Theurlformat is available in Elasticsearch 9.6.0 and later. Not all services and models support all formats. -
Values:
textbase64url -
contentunion oneOfrequired -
An object or an array of objects containing the input data for the model to embed
-
objectorobject[] -
typeenumrequired -
The type of input to embed. Not all models support all input types. The
audio,video, andpdftypes are available in Elasticsearch 9.5.0 and later. -
Values:
textimageaudiovideopdf -
formatenum -
The format of the input. For the
texttype this must betext. For all other types, this must bebase64orurl. If not specified, this will default totextfor thetexttype andbase64for all other types. Theurlformat is available in Elasticsearch 9.6.0 and later. Not all services and models support all formats. -
Values:
textbase64url -
input_typestring -
The input data type for the embedding model. Possible values include:
SEARCHINGESTCLASSIFICATIONCLUSTERING
Not all models support all values. Unsupported values will trigger a validation exception. Accepted values depend on the configured inference service, refer to the relevant service-specific documentation for more info.
NoteThe
input_typeparameter specified on the root level of the request body will take precedence over theinput_typeparameter specified intask_settings.
Allows specifying text-only inputs for the embedding task.
Allows specifying multimodal inputs for the embedding task.
EmbeddingContentObject[]
A wrapper object which contains the fields required to specify multimodal inputs
A wrapper object which contains the fields required to specify multimodal inputs