get-datafeed-stats.asciidoc 5.4 KB

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