get-datafeed-stats.asciidoc 5.6 KB

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