get-datafeed-stats.asciidoc 5.4 KB

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