2019-12-18 03:10:12 -05:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="basic"]
|
|
|
|
[[get-inference-stats]]
|
2020-09-07 06:14:13 -04:00
|
|
|
= Get trained model statistics API
|
2019-12-18 03:10:12 -05:00
|
|
|
[subs="attributes"]
|
|
|
|
++++
|
2020-09-07 06:14:13 -04:00
|
|
|
<titleabbrev>Get trained model stats</titleabbrev>
|
2019-12-18 03:10:12 -05:00
|
|
|
++++
|
|
|
|
|
2020-09-07 06:14:13 -04:00
|
|
|
Retrieves usage information for trained models.
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
experimental[]
|
|
|
|
|
|
|
|
|
|
|
|
[[ml-get-inference-stats-request]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-request-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
`GET _ml/inference/_stats` +
|
|
|
|
|
|
|
|
`GET _ml/inference/_all/_stats` +
|
|
|
|
|
|
|
|
`GET _ml/inference/<model_id>/_stats` +
|
|
|
|
|
|
|
|
`GET _ml/inference/<model_id>,<model_id_2>/_stats` +
|
|
|
|
|
|
|
|
`GET _ml/inference/<model_id_pattern*>,<model_id_2>/_stats`
|
|
|
|
|
|
|
|
|
|
|
|
[[ml-get-inference-stats-prereq]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-prereq-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
2020-01-09 04:44:07 -05:00
|
|
|
Required privileges which should be added to a custom role:
|
|
|
|
|
|
|
|
* cluster: `monitor_ml`
|
2019-12-18 03:10:12 -05:00
|
|
|
|
2020-07-23 19:43:10 -04:00
|
|
|
For more information, see <<security-privileges>> and {ml-docs-setup-privileges}.
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
[[ml-get-inference-stats-desc]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-description-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
You can get usage information for multiple trained models in a single API
|
|
|
|
request by using a comma-separated list of model IDs or a wildcard expression.
|
|
|
|
|
|
|
|
|
|
|
|
[[ml-get-inference-stats-path-params]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-path-parms-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
`<model_id>`::
|
|
|
|
(Optional, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-id]
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
|
|
|
|
[[ml-get-inference-stats-query-params]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-query-parms-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
`allow_no_match`::
|
|
|
|
(Optional, boolean)
|
2020-09-08 11:11:33 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-match-models]
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
`from`::
|
|
|
|
(Optional, integer)
|
2020-09-08 15:54:51 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=from-models]
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
`size`::
|
|
|
|
(Optional, integer)
|
2020-09-08 15:54:51 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=size-models]
|
2019-12-18 03:10:12 -05:00
|
|
|
|
2020-06-19 09:46:51 -04:00
|
|
|
[role="child_attributes"]
|
|
|
|
[[ml-get-inference-stats-results]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-response-body-title}
|
2020-06-19 09:46:51 -04:00
|
|
|
|
|
|
|
`count`::
|
|
|
|
(integer)
|
2020-09-07 06:14:13 -04:00
|
|
|
The total number of trained model statistics that matched the requested ID
|
|
|
|
patterns. Could be higher than the number of items in the `trained_model_stats`
|
|
|
|
array as the size of the array is restricted by the supplied `size` parameter.
|
2020-06-19 09:46:51 -04:00
|
|
|
|
|
|
|
`trained_model_stats`::
|
|
|
|
(array)
|
2020-09-07 06:14:13 -04:00
|
|
|
An array of trained model statistics, which are sorted by the `model_id` value
|
|
|
|
in ascending order.
|
2020-06-19 09:46:51 -04:00
|
|
|
+
|
|
|
|
.Properties of trained model stats
|
|
|
|
[%collapsible%open]
|
|
|
|
====
|
|
|
|
`model_id`:::
|
|
|
|
(string)
|
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-id]
|
|
|
|
|
|
|
|
`pipeline_count`:::
|
|
|
|
(integer)
|
|
|
|
The number of ingest pipelines that currently refer to the model.
|
|
|
|
|
|
|
|
`inference_stats`:::
|
|
|
|
(object)
|
|
|
|
A collection of inference stats fields.
|
|
|
|
+
|
|
|
|
.Properties of inference stats
|
|
|
|
[%collapsible%open]
|
|
|
|
=====
|
|
|
|
|
|
|
|
`missing_all_fields_count`:::
|
|
|
|
(integer)
|
|
|
|
The number of inference calls where all the training features for the model
|
|
|
|
were missing.
|
|
|
|
|
|
|
|
`inference_count`:::
|
|
|
|
(integer)
|
|
|
|
The total number of times the model has been called for inference.
|
|
|
|
This is across all inference contexts, including all pipelines.
|
|
|
|
|
|
|
|
`cache_miss_count`:::
|
|
|
|
(integer)
|
2020-09-07 06:14:13 -04:00
|
|
|
The number of times the model was loaded for inference and was not retrieved
|
|
|
|
from the cache. If this number is close to the `inference_count`, then the cache
|
|
|
|
is not being appropriately used. This can be solved by increasing the cache size
|
|
|
|
or its time-to-live (TTL). See <<general-ml-settings>> for the appropriate
|
|
|
|
settings.
|
2020-06-19 09:46:51 -04:00
|
|
|
|
|
|
|
`failure_count`:::
|
|
|
|
(integer)
|
|
|
|
The number of failures when using the model for inference.
|
|
|
|
|
|
|
|
`timestamp`:::
|
|
|
|
(<<time-units,time units>>)
|
|
|
|
The time when the statistics were last updated.
|
|
|
|
=====
|
|
|
|
|
|
|
|
`ingest`:::
|
|
|
|
(object)
|
|
|
|
A collection of ingest stats for the model across all nodes. The values are
|
|
|
|
summations of the individual node statistics. The format matches the `ingest`
|
|
|
|
section in <<cluster-nodes-stats>>.
|
|
|
|
|
|
|
|
====
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
[[ml-get-inference-stats-response-codes]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-response-codes-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
`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.
|
|
|
|
|
|
|
|
[[ml-get-inference-stats-example]]
|
2020-07-20 16:06:29 -04:00
|
|
|
== {api-examples-title}
|
2019-12-18 03:10:12 -05:00
|
|
|
|
|
|
|
The following example gets usage information for all the trained models:
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
GET _ml/inference/_stats
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:TBD]
|
|
|
|
|
|
|
|
|
|
|
|
The API returns the following results:
|
|
|
|
|
|
|
|
[source,console-result]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"count": 2,
|
|
|
|
"trained_model_stats": [
|
|
|
|
{
|
|
|
|
"model_id": "flight-delay-prediction-1574775339910",
|
2020-06-19 09:46:51 -04:00
|
|
|
"pipeline_count": 0,
|
|
|
|
"inference_stats": {
|
|
|
|
"failure_count": 0,
|
|
|
|
"inference_count": 4,
|
|
|
|
"cache_miss_count": 3,
|
|
|
|
"missing_all_fields_count": 0,
|
|
|
|
"timestamp": 1592399986979
|
|
|
|
}
|
2019-12-18 03:10:12 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"model_id": "regression-job-one-1574775307356",
|
|
|
|
"pipeline_count": 1,
|
2020-06-19 09:46:51 -04:00
|
|
|
"inference_stats": {
|
|
|
|
"failure_count": 0,
|
|
|
|
"inference_count": 178,
|
|
|
|
"cache_miss_count": 3,
|
|
|
|
"missing_all_fields_count": 0,
|
|
|
|
"timestamp": 1592399986979
|
|
|
|
},
|
2019-12-18 03:10:12 -05:00
|
|
|
"ingest": {
|
|
|
|
"total": {
|
|
|
|
"count": 178,
|
|
|
|
"time_in_millis": 8,
|
|
|
|
"current": 0,
|
|
|
|
"failed": 0
|
|
|
|
},
|
|
|
|
"pipelines": {
|
|
|
|
"flight-delay": {
|
|
|
|
"count": 178,
|
|
|
|
"time_in_millis": 8,
|
|
|
|
"current": 0,
|
|
|
|
"failed": 0,
|
|
|
|
"processors": [
|
|
|
|
{
|
|
|
|
"inference": {
|
|
|
|
"type": "inference",
|
|
|
|
"stats": {
|
|
|
|
"count": 178,
|
|
|
|
"time_in_millis": 7,
|
|
|
|
"current": 0,
|
|
|
|
"failed": 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|
2020-06-19 09:46:51 -04:00
|
|
|
// NOTCONSOLE
|