Get inference trained model API

edit

Retrieves configuration information for a trained inference model.

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.

Request

edit

GET _ml/inference/

GET _ml/inference/<model_id>

GET _ml/inference/_all

GET _ml/inference/<model_id1>,<model_id2>

GET _ml/inference/<model_id_pattern*>

Prerequisites

edit

Required privileges which should be added to a custom role:

  • cluster: monitor_ml

For more information, see Security privileges and Built-in roles.

Description

edit

You can get information for multiple trained models in a single API request by using a comma-separated list of model IDs or a wildcard expression.

Path parameters

edit
<model_id>
(Optional, string) The unique identifier of the trained inference model.

Query parameters

edit
allow_no_match

(Optional, boolean) Specifies what to do when the request:

  • Contains wildcard expressions and there are no data frame analytics jobs that match.
  • Contains the _all string or no identifiers and there are no matches.
  • Contains wildcard expressions and there are only partial matches.

The default value is true, which returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

decompress_definition
(Optional, boolean) Specifies whether the included model definition should be returned as a JSON map (true) or in a custom compressed format (false). Defaults to true.
from
(Optional, integer) Skips the specified number of data frame analytics jobs. The default value is 0.
include_model_definition
(Optional, boolean) Specifies if the model definition should be returned in the response. Defaults to false. When true, only a single model must match the ID patterns provided, otherwise a bad request is returned.
size
(Optional, integer) Specifies the maximum number of data frame analytics jobs to obtain. The default value is 100.

Response body

edit
trained_model_configs

(array) An array of trained model resources, which are sorted by the model_id value in ascending order.

model_id
(string) Idetifier for the trained model.
created_by
(string) Information on the creator of the trained model.
version
(string) The Elasticsearch version number in which the trained model was created.
create_time
(time units) The time when the trained model was created.
tags
(string) A comma delimited string of tags. A inference model can have many tags, or none.
metadata
(object) An object containing metadata about the trained model. For example, models created by data frame analytics contain an analysis_config and an input object.
estimated_heap_memory_usage_bytes
(integer) The estimated heap usage in bytes to keep the trained model in memory.
estimated_operations
(integer) The estimated number of operations to use the trained model.
license_level
(string) The license level of the trained model.

Response codes

edit
400
If include_model_definition is true, this code indicates that more than one models match the ID pattern.
404 (Missing resources)
If allow_no_match is false, this code indicates that there are no resources that match the request or only partial matches for the request.

Examples

edit

The following example gets configuration information for all the trained models:

GET _ml/inference/