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

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