get-datafeed-stats.asciidoc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-datafeed-stats]]
  4. = Get {dfeed} statistics API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Get {dfeed} statistics</titleabbrev>
  8. ++++
  9. Retrieves usage information for {dfeeds}.
  10. [[ml-get-datafeed-stats-request]]
  11. == {api-request-title}
  12. `GET _ml/datafeeds/<feed_id>/_stats` +
  13. `GET _ml/datafeeds/<feed_id>,<feed_id>/_stats` +
  14. `GET _ml/datafeeds/_stats` +
  15. `GET _ml/datafeeds/_all/_stats`
  16. [[ml-get-datafeed-stats-prereqs]]
  17. == {api-prereq-title}
  18. * If the {es} {security-features} are enabled, you must have `monitor_ml`,
  19. `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
  20. <<security-privileges>> and {ml-docs-setup-privileges}.
  21. [[ml-get-datafeed-stats-desc]]
  22. == {api-description-title}
  23. You can get statistics for multiple {dfeeds} in a single API request by using a
  24. comma-separated list of {dfeeds} or a wildcard expression. You can get
  25. statistics for all {dfeeds} by using `_all`, by specifying `*` as the
  26. `<feed_id>`, or by omitting the `<feed_id>`.
  27. If the {dfeed} is stopped, the only information you receive is the
  28. `datafeed_id` and the `state`.
  29. IMPORTANT: This API returns a maximum of 10,000 {dfeeds}.
  30. [[ml-get-datafeed-stats-path-parms]]
  31. == {api-path-parms-title}
  32. `<feed_id>`::
  33. (Optional, string)
  34. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id-wildcard]
  35. +
  36. --
  37. If you do not specify one of these options, the API returns information about
  38. all {dfeeds}.
  39. --
  40. [[ml-get-datafeed-stats-query-parms]]
  41. == {api-query-parms-title}
  42. `allow_no_match`::
  43. (Optional, boolean)
  44. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-datafeeds]
  45. [role="child_attributes"]
  46. [[ml-get-datafeed-stats-results]]
  47. == {api-response-body-title}
  48. The API returns an array of {dfeed} count objects. All of these properties are
  49. informational; you cannot update their values.
  50. `assignment_explanation`::
  51. (string)
  52. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=assignment-explanation-datafeeds]
  53. `datafeed_id`::
  54. (string)
  55. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  56. `node`::
  57. (object)
  58. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-datafeeds]
  59. +
  60. --
  61. [%collapsible%open]
  62. ====
  63. `attributes`:::
  64. (object)
  65. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-attributes]
  66. `ephemeral_id`:::
  67. (string)
  68. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-ephemeral-id]
  69. `id`:::
  70. (string)
  71. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-id]
  72. `name`:::
  73. (string)
  74. The node name. For example, `0-o0tOo`.
  75. `transport_address`:::
  76. (string)
  77. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-transport-address]
  78. ====
  79. --
  80. `state`::
  81. (string)
  82. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=state-datafeed]
  83. `timing_stats`::
  84. (object) An object that provides statistical information about timing aspect of
  85. this {dfeed}.
  86. +
  87. --
  88. [%collapsible%open]
  89. ====
  90. `average_search_time_per_bucket_ms`:::
  91. (double)
  92. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=search-bucket-avg]
  93. `bucket_count`:::
  94. (long)
  95. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-count]
  96. `exponential_average_search_time_per_hour_ms`:::
  97. (double)
  98. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=search-exp-avg-hour]
  99. `job_id`:::
  100. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  101. `search_count`:::
  102. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=search-count]
  103. `total_search_time_ms`:::
  104. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=search-time]
  105. ====
  106. --
  107. [[ml-get-datafeed-stats-response-codes]]
  108. == {api-response-codes-title}
  109. `404` (Missing resources)::
  110. If `allow_no_match` is `false`, this code indicates that there are no
  111. resources that match the request or only partial matches for the request.
  112. [[ml-get-datafeed-stats-example]]
  113. == {api-examples-title}
  114. [source,console]
  115. --------------------------------------------------
  116. GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats
  117. --------------------------------------------------
  118. // TEST[skip:Kibana sample data started datafeed]
  119. The API returns the following results:
  120. [source,console-result]
  121. ----
  122. {
  123. "count" : 1,
  124. "datafeeds" : [
  125. {
  126. "datafeed_id" : "datafeed-high_sum_total_sales",
  127. "state" : "started",
  128. "node" : {
  129. "id" : "7bmMXyWCRs-TuPfGJJ_yMw",
  130. "name" : "node-0",
  131. "ephemeral_id" : "hoXMLZB0RWKfR9UPPUCxXX",
  132. "transport_address" : "127.0.0.1:9300",
  133. "attributes" : {
  134. "ml.machine_memory" : "17179869184",
  135. "ml.max_open_jobs" : "20"
  136. }
  137. },
  138. "assignment_explanation" : "",
  139. "timing_stats" : {
  140. "job_id" : "high_sum_total_sales",
  141. "search_count" : 7,
  142. "bucket_count" : 743,
  143. "total_search_time_ms" : 134.0,
  144. "average_search_time_per_bucket_ms" : 0.180349932705249,
  145. "exponential_average_search_time_per_hour_ms" : 11.514712961628677
  146. }
  147. }
  148. ]
  149. }
  150. ----
  151. // TESTRESPONSE[s/"7bmMXyWCRs-TuPfGJJ_yMw"/$body.$_path/]
  152. // TESTRESPONSE[s/"node-0"/$body.$_path/]
  153. // TESTRESPONSE[s/"hoXMLZB0RWKfR9UPPUCxXX"/$body.$_path/]
  154. // TESTRESPONSE[s/"127.0.0.1:9300"/$body.$_path/]
  155. // TESTRESPONSE[s/"17179869184"/$body.datafeeds.0.node.attributes.ml\\.machine_memory/]