get-dfanalytics-stats.asciidoc 3.9 KB

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