get-datafeed-stats.asciidoc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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>>.
  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::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id-wildcard]
  35. If you do not specify one of these options, the API returns information about
  36. all {dfeeds}.
  37. [[ml-get-datafeed-stats-query-parms]]
  38. ==== {api-query-parms-title}
  39. `allow_no_datafeeds`::
  40. (Optional, boolean)
  41. include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-datafeeds]
  42. [[ml-get-datafeed-stats-results]]
  43. ==== {api-response-body-title}
  44. The API returns an array of {dfeed} count objects. All of these properties are
  45. informational; you cannot update their values.
  46. `assignment_explanation`::
  47. (string) For started {dfeeds} only, contains messages relating to the selection of a node.
  48. `datafeed_id`::
  49. (string)
  50. include::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  51. `node`::
  52. (object) For started {dfeeds} only, the node upon which the {dfeed} is started. The {dfeed} and job will be on the same node.
  53. `id`::: The unique identifier of the node. For example, "0-o0tOoRTwKFZifatTWKNw".
  54. `name`::: The node name. For example, `0-o0tOo`.
  55. `ephemeral_id`::: The node ephemeral ID.
  56. `transport_address`::: The host and port where transport HTTP connections are
  57. accepted. For example, `127.0.0.1:9300`.
  58. `attributes`::: For example, `{"ml.machine_memory": "17179869184"}`.
  59. `state`::
  60. (string) The status of the {dfeed}, which can be one of the following values:
  61. +
  62. --
  63. * `started`: The {dfeed} is actively receiving data.
  64. * `stopped`: The {dfeed} is stopped and will not receive data until it is
  65. re-started.
  66. --
  67. `timing_stats`::
  68. (object) An object that provides statistical information about timing aspect of
  69. this {dfeed}.
  70. //average_search_time_per_bucket_ms
  71. //bucket_count
  72. //exponential_average_search_time_per_hour_ms
  73. `job_id`:::
  74. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  75. `search_count`::: Number of searches performed by this {dfeed}.
  76. `total_search_time_ms`::: Total time the {dfeed} spent searching in milliseconds.
  77. [[ml-get-datafeed-stats-response-codes]]
  78. ==== {api-response-codes-title}
  79. `404` (Missing resources)::
  80. If `allow_no_datafeeds` is `false`, this code indicates that there are no
  81. resources that match the request or only partial matches for the request.
  82. [[ml-get-datafeed-stats-example]]
  83. ==== {api-examples-title}
  84. [source,console]
  85. --------------------------------------------------
  86. GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats
  87. --------------------------------------------------
  88. // TEST[skip:Kibana sample data started datafeed]
  89. The API returns the following results:
  90. [source,console-result]
  91. ----
  92. {
  93. "count" : 1,
  94. "datafeeds" : [
  95. {
  96. "datafeed_id" : "datafeed-high_sum_total_sales",
  97. "state" : "started",
  98. "node" : {
  99. "id" : "7bmMXyWCRs-TuPfGJJ_yMw",
  100. "name" : "node-0",
  101. "ephemeral_id" : "hoXMLZB0RWKfR9UPPUCxXX",
  102. "transport_address" : "127.0.0.1:9300",
  103. "attributes" : {
  104. "ml.machine_memory" : "17179869184",
  105. "ml.max_open_jobs" : "20"
  106. }
  107. },
  108. "assignment_explanation" : "",
  109. "timing_stats" : {
  110. "job_id" : "high_sum_total_sales",
  111. "search_count" : 7,
  112. "bucket_count" : 743,
  113. "total_search_time_ms" : 134.0,
  114. "average_search_time_per_bucket_ms" : 0.180349932705249,
  115. "exponential_average_search_time_per_hour_ms" : 11.514712961628677
  116. }
  117. }
  118. ]
  119. }
  120. ----
  121. // TESTRESPONSE[s/"7bmMXyWCRs-TuPfGJJ_yMw"/$body.$_path/]
  122. // TESTRESPONSE[s/"node-0"/$body.$_path/]
  123. // TESTRESPONSE[s/"hoXMLZB0RWKfR9UPPUCxXX"/$body.$_path/]
  124. // TESTRESPONSE[s/"127.0.0.1:9300"/$body.$_path/]
  125. // TESTRESPONSE[s/"17179869184"/$body.datafeeds.0.node.attributes.ml\\.machine_memory/]