Get inference API

edit

This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

Retrieves inference model information.

The inference APIs enable you to use certain services, such as ELSER, OpenAI, or Hugging Face, in your cluster. This is not the same feature that you can use on an ML node with custom machine learning models. If you want to train and use your own model, use the Machine learning trained model APIs.

Request

edit

GET /_inference/_all

GET /_inference/<task_type>/_all

GET /_inference/<task_type>/<model_id>

Prerequisites

edit

Description

edit

You can get information in a single API request for:

  • a single inference model by providing the task type and the model ID,
  • all of the inference models for a certain task type by providing the task type and a wildcard expression,
  • all of the inference models by using a wildcard expression.

Path parameters

edit
<model_id>
(Optional, string) The unique identifier of the inference model.
<task_type>
(Optional, string) The type of inference task that the model performs.

Examples

edit

The following API call retrives information about the my-elser-model inference model that can perform sparse_embedding tasks.

response = client.inference.get_model(
  task_type: 'sparse_embedding',
  model_id: 'my-elser-model'
)
puts response
GET _inference/sparse_embedding/my-elser-model

The API returns the following response:

{
  "model_id": "my-elser-model",
  "task_type": "sparse_embedding",
  "service": "elser",
  "service_settings": {
    "num_allocations": 1,
    "num_threads": 1
  },
  "task_settings": {}
}