get-datafeed-stats.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. {stack-ov}/security-privileges.html[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>` (Optional)::
  33. (string) Identifier for the {dfeed}. It can be a {dfeed} identifier or a
  34. wildcard expression. If you do not specify one of these options, the API
  35. returns statistics for all {dfeeds}.
  36. [[ml-get-datafeed-stats-results]]
  37. ==== {api-response-body-title}
  38. The API returns the following information:
  39. `datafeeds`::
  40. (array) An array of {dfeed} count objects.
  41. For more information, see <<ml-datafeed-counts>>.
  42. [[ml-get-datafeed-stats-example]]
  43. ==== {api-examples-title}
  44. The following example gets usage information for the
  45. `datafeed-total-requests` {dfeed}:
  46. [source,js]
  47. --------------------------------------------------
  48. GET _ml/datafeeds/datafeed-total-requests/_stats
  49. --------------------------------------------------
  50. // CONSOLE
  51. // TEST[skip:setup:server_metrics_startdf]
  52. The API returns the following results:
  53. [source,js]
  54. ----
  55. {
  56. "count": 1,
  57. "datafeeds": [
  58. {
  59. "datafeed_id": "datafeed-total-requests",
  60. "state": "started",
  61. "node": {
  62. "id": "2spCyo1pRi2Ajo-j-_dnPX",
  63. "name": "node-0",
  64. "ephemeral_id": "hoXMLZB0RWKfR9UPPUCxXX",
  65. "transport_address": "127.0.0.1:9300",
  66. "attributes": {
  67. "ml.machine_memory": "17179869184",
  68. "ml.max_open_jobs": "20"
  69. }
  70. },
  71. "assignment_explanation": "",
  72. "timing_stats": {
  73. "job_id": "job-total-requests",
  74. "search_count": 20,
  75. "total_search_time_ms": 120.5
  76. }
  77. }
  78. ]
  79. }
  80. ----
  81. // TESTRESPONSE[s/"2spCyo1pRi2Ajo-j-_dnPX"/$body.$_path/]
  82. // TESTRESPONSE[s/"node-0"/$body.$_path/]
  83. // TESTRESPONSE[s/"hoXMLZB0RWKfR9UPPUCxXX"/$body.$_path/]
  84. // TESTRESPONSE[s/"127.0.0.1:9300"/$body.$_path/]
  85. // TESTRESPONSE[s/"17179869184"/$body.datafeeds.0.node.attributes.ml\\.machine_memory/]