Perform dense embedding inference on the service
- POST /_inference/embedding/{inference_id}
Path Parameters
-
inference_idstring Idrequired -
The inference Id
Query Parameters
-
timeoutstring Duration · default: 30s Specifies the amount of time to wait for the inference request to complete.
Request
-
inputEmbeddingInputrequired -
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" } ] } ] -
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.
info The
input_typeparameter specified on the root level of the request body will take precedence over theinput_typeparameter specified intask_settings. -
task_settingsTaskSettings -
Task settings for the individual inference request. These settings are specific to the <task_type> you specified and override the task settings specified when initializing the service.
Response
-
embeddings_bytesDenseEmbeddingByteResult -
embeddingDenseByteVectorrequired -
embeddings_bitsDenseEmbeddingByteResult -
embeddingDenseByteVectorrequired -
embeddingsDenseEmbeddingResult -
embeddingDenseVectorrequired