get-dfanalytics-stats.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[get-dfanalytics-stats]]
  4. === Get {dfanalytics-jobs} statistics API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Get {dfanalytics-jobs} stats</titleabbrev>
  8. ++++
  9. Retrieves usage information for {dfanalytics-jobs}.
  10. experimental[]
  11. [[ml-get-dfanalytics-stats-request]]
  12. ==== {api-request-title}
  13. `GET _ml/data_frame/analytics/<data_frame_analytics_id>/_stats` +
  14. `GET _ml/data_frame/analytics/<data_frame_analytics_id>,<data_frame_analytics_id>/_stats` +
  15. `GET _ml/data_frame/analytics/_stats` +
  16. `GET _ml/data_frame/analytics/_all/_stats` +
  17. `GET _ml/data_frame/analytics/*/_stats`
  18. [[ml-get-dfanalytics-stats-prereq]]
  19. ==== {api-prereq-title}
  20. * You must have `monitor_ml` privilege to use this API. For more
  21. information, see {stack-ov}/security-privileges.html[Security privileges] and
  22. {stack-ov}/built-in-roles.html[Built-in roles].
  23. [[ml-get-dfanalytics-stats-path-params]]
  24. ==== {api-path-parms-title}
  25. `<data_frame_analytics_id>`::
  26. (Optional, string)Identifier for the {dfanalytics-job}. If you do not specify
  27. one of these options, the API returns information for the first hundred
  28. {dfanalytics-jobs}.
  29. [[ml-get-dfanalytics-stats-query-params]]
  30. ==== {api-query-parms-title}
  31. `allow_no_match`::
  32. (Optional, boolean) Specifies what to do when the request:
  33. +
  34. --
  35. * Contains wildcard expressions and there are no {dfanalytics-jobs} that match.
  36. * Contains the `_all` string or no identifiers and there are no matches.
  37. * Contains wildcard expressions and there are only partial matches.
  38. The default value is `true`, which returns an empty `data_frame_analytics` array
  39. when there are no matches and the subset of results when there are partial
  40. matches. If this parameter is `false`, the request returns a `404` status code
  41. when there are no matches or only partial matches.
  42. --
  43. `from`::
  44. (Optional, integer) Skips the specified number of {dfanalytics-jobs}. The
  45. default value is `0`.
  46. `size`::
  47. (Optional, integer) Specifies the maximum number of {dfanalytics-jobs} to
  48. obtain. The default value is `100`.
  49. [[ml-get-dfanalytics-stats-response-body]]
  50. ==== {api-response-body-title}
  51. The API returns the following information:
  52. `data_frame_analytics`::
  53. (array) An array of statistics objects for {dfanalytics-jobs}, which are
  54. sorted by the `id` value in ascending order.
  55. `id`::
  56. (string) The unique identifier of the {dfanalytics-job}.
  57. `state`::
  58. (string) Current state of the {dfanalytics-job}.
  59. `progress`::
  60. (array) The progress report of the {dfanalytics-job} by phase.
  61. `phase`::
  62. (string) Defines the phase of the {dfanalytics-job}. Possible phases:
  63. `reindexing`, `loading_data`, `analyzing`, and `writing_results`.
  64. `progress_percent`::
  65. (integer) The progress that the {dfanalytics-job} has made expressed in
  66. percentage.
  67. [[ml-get-dfanalytics-stats-response-codes]]
  68. ==== {api-response-codes-title}
  69. `404` (Missing resources)::
  70. If `allow_no_match` is `false`, this code indicates that there are no
  71. resources that match the request or only partial matches for the request.
  72. [[ml-get-dfanalytics-stats-example]]
  73. ==== {api-examples-title}
  74. [source,console]
  75. --------------------------------------------------
  76. GET _ml/data_frame/analytics/loganalytics/_stats
  77. --------------------------------------------------
  78. // TEST[skip:TBD]
  79. The API returns the following results:
  80. [source,console-result]
  81. ----
  82. {
  83. "count": 1,
  84. "data_frame_analytics": [
  85. {
  86. "id": "loganalytics",
  87. "state": "stopped",
  88. "progress": [
  89. {
  90. "phase": "reindexing",
  91. "progress_percent": 0
  92. },
  93. {
  94. "phase": "loading_data",
  95. "progress_percent": 0
  96. },
  97. {
  98. "phase": "analyzing",
  99. "progress_percent": 0
  100. },
  101. {
  102. "phase": "writing_results",
  103. "progress_percent": 0
  104. }
  105. ]
  106. }
  107. ]
  108. }
  109. ----