123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- [role="xpack"]
- [testenv="basic"]
- [[get-inference-stats]]
- === Get {infer} trained model statistics API
- [subs="attributes"]
- ++++
- <titleabbrev>Get {infer} trained model stats</titleabbrev>
- ++++
- Retrieves usage information for trained {infer} models.
- experimental[]
- [[ml-get-inference-stats-request]]
- ==== {api-request-title}
- `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]]
- ==== {api-prereq-title}
- Required privileges which should be added to a custom role:
- * cluster: `monitor_ml`
-
- For more information, see <<security-privileges>> and <<built-in-roles>>.
- [[ml-get-inference-stats-desc]]
- ==== {api-description-title}
- 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]]
- ==== {api-path-parms-title}
- `<model_id>`::
- (Optional, string)
- include::{docdir}/ml/ml-shared.asciidoc[tag=model-id]
- [[ml-get-inference-stats-query-params]]
- ==== {api-query-parms-title}
- `allow_no_match`::
- (Optional, boolean)
- include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-match]
- `from`::
- (Optional, integer)
- include::{docdir}/ml/ml-shared.asciidoc[tag=from]
- `size`::
- (Optional, integer)
- include::{docdir}/ml/ml-shared.asciidoc[tag=size]
- [[ml-get-inference-stats-response-codes]]
- ==== {api-response-codes-title}
- `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]]
- ==== {api-examples-title}
- 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",
- "pipeline_count": 0
- },
- {
- "model_id": "regression-job-one-1574775307356",
- "pipeline_count": 1,
- "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
- }
- }
- }
- ]
- }
- }
- }
- }
- ]
- }
- ----
- // NOTCONSOLE
|