get-inference-trained-model-stats.asciidoc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[get-inference-stats]]
  4. === Get {infer} trained model statistics API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Get {infer} trained model stats</titleabbrev>
  8. ++++
  9. Retrieves usage information for trained {infer} models.
  10. experimental[]
  11. [[ml-get-inference-stats-request]]
  12. ==== {api-request-title}
  13. `GET _ml/inference/_stats` +
  14. `GET _ml/inference/_all/_stats` +
  15. `GET _ml/inference/<model_id>/_stats` +
  16. `GET _ml/inference/<model_id>,<model_id_2>/_stats` +
  17. `GET _ml/inference/<model_id_pattern*>,<model_id_2>/_stats`
  18. [[ml-get-inference-stats-prereq]]
  19. ==== {api-prereq-title}
  20. If the {es} {security-features} are enabled, you must have the following
  21. privileges:
  22. * cluster: `monitor_ml`
  23. For more information, see <<security-privileges>> and <<built-in-roles>>.
  24. [[ml-get-inference-stats-desc]]
  25. ==== {api-description-title}
  26. You can get usage information for multiple trained models in a single API
  27. request by using a comma-separated list of model IDs or a wildcard expression.
  28. [[ml-get-inference-stats-path-params]]
  29. ==== {api-path-parms-title}
  30. `<model_id>`::
  31. (Optional, string)
  32. include::{docdir}/ml/ml-shared.asciidoc[tag=model-id]
  33. [[ml-get-inference-stats-query-params]]
  34. ==== {api-query-parms-title}
  35. `allow_no_match`::
  36. (Optional, boolean)
  37. include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-match]
  38. `from`::
  39. (Optional, integer)
  40. include::{docdir}/ml/ml-shared.asciidoc[tag=from]
  41. `size`::
  42. (Optional, integer)
  43. include::{docdir}/ml/ml-shared.asciidoc[tag=size]
  44. [[ml-get-inference-stats-response-codes]]
  45. ==== {api-response-codes-title}
  46. `404` (Missing resources)::
  47. If `allow_no_match` is `false`, this code indicates that there are no
  48. resources that match the request or only partial matches for the request.
  49. [[ml-get-inference-stats-example]]
  50. ==== {api-examples-title}
  51. The following example gets usage information for all the trained models:
  52. [source,console]
  53. --------------------------------------------------
  54. GET _ml/inference/_stats
  55. --------------------------------------------------
  56. // TEST[skip:TBD]
  57. The API returns the following results:
  58. [source,console-result]
  59. ----
  60. {
  61. "count": 2,
  62. "trained_model_stats": [
  63. {
  64. "model_id": "flight-delay-prediction-1574775339910",
  65. "pipeline_count": 0
  66. },
  67. {
  68. "model_id": "regression-job-one-1574775307356",
  69. "pipeline_count": 1,
  70. "ingest": {
  71. "total": {
  72. "count": 178,
  73. "time_in_millis": 8,
  74. "current": 0,
  75. "failed": 0
  76. },
  77. "pipelines": {
  78. "flight-delay": {
  79. "count": 178,
  80. "time_in_millis": 8,
  81. "current": 0,
  82. "failed": 0,
  83. "processors": [
  84. {
  85. "inference": {
  86. "type": "inference",
  87. "stats": {
  88. "count": 178,
  89. "time_in_millis": 7,
  90. "current": 0,
  91. "failed": 0
  92. }
  93. }
  94. }
  95. ]
  96. }
  97. }
  98. }
  99. }
  100. ]
  101. }
  102. ----
  103. // NOTCONSOLE