get-job-stats.asciidoc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-job-stats]]
  4. = Get {anomaly-job} statistics API
  5. ++++
  6. <titleabbrev>Get job statistics</titleabbrev>
  7. ++++
  8. Retrieves usage information for {anomaly-jobs}.
  9. [[ml-get-job-stats-request]]
  10. == {api-request-title}
  11. `GET _ml/anomaly_detectors/<job_id>/_stats`
  12. `GET _ml/anomaly_detectors/<job_id>,<job_id>/_stats` +
  13. `GET _ml/anomaly_detectors/_stats` +
  14. `GET _ml/anomaly_detectors/_all/_stats`
  15. [[ml-get-job-stats-prereqs]]
  16. == {api-prereq-title}
  17. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  18. `machine_learning_user` built-in role.
  19. [[ml-get-job-stats-desc]]
  20. == {api-description-title}
  21. You can get statistics for multiple {anomaly-jobs} in a single API request by
  22. using a group name, a comma-separated list of jobs, or a wildcard expression.
  23. You can get statistics for all {anomaly-jobs} by using `_all`, by specifying `*`
  24. as the `<job_id>`, or by omitting the `<job_id>`.
  25. IMPORTANT: This API returns a maximum of 10,000 jobs.
  26. [[ml-get-job-stats-path-parms]]
  27. == {api-path-parms-title}
  28. `<job_id>`::
  29. (Optional, string)
  30. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
  31. [[ml-get-job-stats-query-parms]]
  32. == {api-query-parms-title}
  33. `allow_no_match`::
  34. (Optional, Boolean)
  35. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
  36. [role="child_attributes"]
  37. [[ml-get-job-stats-results]]
  38. == {api-response-body-title}
  39. The API returns the following information about the operational progress of a
  40. job:
  41. `assignment_explanation`::
  42. (string)
  43. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=assignment-explanation-anomaly-jobs]
  44. //Begin data_counts
  45. [[datacounts]]`data_counts`::
  46. (object) An object that describes the quantity of input to the job and any
  47. related error counts. The `data_count` values are cumulative for the lifetime of
  48. a job. If a model snapshot is reverted or old results are deleted, the job
  49. counts are not reset.
  50. +
  51. .Properties of `data_counts`
  52. [%collapsible%open]
  53. ====
  54. `bucket_count`:::
  55. (long)
  56. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-count-anomaly-jobs]
  57. `earliest_record_timestamp`:::
  58. (date)
  59. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=earliest-record-timestamp]
  60. `empty_bucket_count`:::
  61. (long)
  62. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=empty-bucket-count]
  63. `input_bytes`:::
  64. (long)
  65. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=input-bytes]
  66. `input_field_count`:::
  67. (long)
  68. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=input-field-count]
  69. `input_record_count`:::
  70. (long)
  71. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=input-record-count]
  72. `invalid_date_count`:::
  73. (long)
  74. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=invalid-date-count]
  75. `job_id`:::
  76. (string)
  77. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  78. `last_data_time`:::
  79. (date)
  80. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=last-data-time]
  81. `latest_empty_bucket_timestamp`:::
  82. (date)
  83. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=latest-empty-bucket-timestamp]
  84. `latest_record_timestamp`:::
  85. (date)
  86. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=latest-record-timestamp]
  87. `latest_sparse_bucket_timestamp`:::
  88. (date)
  89. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=latest-sparse-record-timestamp]
  90. `log_time`:::
  91. (date) The timestamp of the `data_counts` according to server time.
  92. `missing_field_count`:::
  93. (long)
  94. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=missing-field-count]
  95. +
  96. The value of `processed_record_count` includes this count.
  97. `out_of_order_timestamp_count`:::
  98. (long)
  99. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=out-of-order-timestamp-count]
  100. `processed_field_count`:::
  101. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=processed-field-count]
  102. `processed_record_count`:::
  103. (long)
  104. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=processed-record-count]
  105. `sparse_bucket_count`:::
  106. (long)
  107. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=sparse-bucket-count]
  108. ====
  109. //End data_counts
  110. `deleting`::
  111. (Boolean)
  112. Indicates that the process of deleting the job is in progress but not yet
  113. completed. It is only reported when `true`.
  114. //Begin forecasts_stats
  115. [[forecastsstats]]`forecasts_stats`::
  116. (object) An object that provides statistical information about forecasts
  117. belonging to this job. Some statistics are omitted if no forecasts have been
  118. made.
  119. +
  120. NOTE: Unless there is at least one forecast, `memory_bytes`, `records`,
  121. `processing_time_ms` and `status` properties are omitted.
  122. +
  123. .Properties of `forecasts_stats`
  124. [%collapsible%open]
  125. ====
  126. `forecasted_jobs`:::
  127. (long) A value of `0` indicates that forecasts do not exist for this job. A
  128. value of `1` indicates that at least one forecast exists.
  129. `memory_bytes`:::
  130. (object) The `avg`, `min`, `max` and `total` memory usage in bytes for forecasts
  131. related to this job. If there are no forecasts, this property is omitted.
  132. `records`:::
  133. (object) The `avg`, `min`, `max` and `total` number of `model_forecast` documents
  134. written for forecasts related to this job. If there are no forecasts, this
  135. property is omitted.
  136. `processing_time_ms`:::
  137. (object) The `avg`, `min`, `max` and `total` runtime in milliseconds for
  138. forecasts related to this job. If there are no forecasts, this property is omitted.
  139. `status`:::
  140. (object) The count of forecasts by their status. For example:
  141. {"finished" : 2, "started" : 1}. If there are no forecasts, this property is omitted.
  142. `total`:::
  143. (long)
  144. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=forecast-total]
  145. ====
  146. //End forecasts_stats
  147. `job_id`::
  148. (string)
  149. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  150. //Begin model_size_stats
  151. [[modelsizestats]]`model_size_stats`::
  152. (object) An object that provides information about the size and contents of the
  153. model.
  154. +
  155. .Properties of `model_size_stats`
  156. [%collapsible%open]
  157. ====
  158. `assignment_memory_basis`:::
  159. (string)
  160. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=assignment-memory-basis]
  161. `bucket_allocation_failures_count`:::
  162. (long)
  163. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-allocation-failures-count]
  164. `categorized_doc_count`:::
  165. (long)
  166. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=categorized-doc-count]
  167. `categorization_status`:::
  168. (string)
  169. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=categorization-status]
  170. `dead_category_count`:::
  171. (long)
  172. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=dead-category-count]
  173. `failed_category_count`:::
  174. (long)
  175. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=failed-category-count]
  176. `frequent_category_count`:::
  177. (long)
  178. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequent-category-count]
  179. `job_id`:::
  180. (string)
  181. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  182. `log_time`:::
  183. (date) The timestamp of the `model_size_stats` according to server time.
  184. `memory_status`:::
  185. (string)
  186. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-memory-status]
  187. `model_bytes`:::
  188. (long)
  189. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-bytes]
  190. `model_bytes_exceeded`:::
  191. (long)
  192. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-bytes-exceeded]
  193. `model_bytes_memory_limit`:::
  194. (long)
  195. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-memory-limit-anomaly-jobs]
  196. `peak_model_bytes`:::
  197. (long)
  198. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=peak-model-bytes]
  199. `rare_category_count`:::
  200. (long)
  201. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=rare-category-count]
  202. `result_type`:::
  203. (string) For internal use. The type of result.
  204. `total_by_field_count`:::
  205. (long)
  206. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-by-field-count]
  207. `total_category_count`:::
  208. (long)
  209. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-category-count]
  210. `total_over_field_count`:::
  211. (long)
  212. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-over-field-count]
  213. `total_partition_field_count`:::
  214. (long)
  215. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-partition-field-count]
  216. `timestamp`:::
  217. (date)
  218. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-timestamp]
  219. ====
  220. //End model_size_stats
  221. //Begin node
  222. [[stats-node]]`node`::
  223. (object) Contains properties for the node that runs the job. This information is
  224. available only for open jobs.
  225. +
  226. .Properties of `node`
  227. [%collapsible%open]
  228. ====
  229. `attributes`:::
  230. (object)
  231. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-attributes]
  232. `ephemeral_id`:::
  233. (string)
  234. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-ephemeral-id]
  235. `id`:::
  236. (string)
  237. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-id]
  238. `name`:::
  239. (string) The node name.
  240. `transport_address`:::
  241. (string)
  242. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-transport-address]
  243. ====
  244. //End node
  245. `open_time`::
  246. (string)
  247. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=open-time]
  248. `state`::
  249. (string)
  250. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=state-anomaly-job]
  251. //Begin timing_stats
  252. [[timingstats]]`timing_stats`::
  253. (object) An object that provides statistical information about timing aspect of
  254. this job.
  255. +
  256. .Properties of `timing_stats`
  257. [%collapsible%open]
  258. ====
  259. `average_bucket_processing_time_ms`:::
  260. (double) Average of all bucket processing times in milliseconds.
  261. `bucket_count`:::
  262. (long)
  263. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-count]
  264. `exponential_average_bucket_processing_time_ms`:::
  265. (double)
  266. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-exponential-average]
  267. `exponential_average_bucket_processing_time_per_hour_ms`:::
  268. (double)
  269. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-exponential-average-hour]
  270. `job_id`:::
  271. (string)
  272. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  273. `maximum_bucket_processing_time_ms`:::
  274. (double)
  275. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-maximum]
  276. `minimum_bucket_processing_time_ms`:::
  277. (double)
  278. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-minimum]
  279. `total_bucket_processing_time_ms`:::
  280. (double)
  281. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-total]
  282. ====
  283. //End timing_stats
  284. [[ml-get-job-stats-response-codes]]
  285. == {api-response-codes-title}
  286. `404` (Missing resources)::
  287. If `allow_no_match` is `false`, this code indicates that there are no
  288. resources that match the request or only partial matches for the request.
  289. [[ml-get-job-stats-example]]
  290. == {api-examples-title}
  291. [source,console]
  292. --------------------------------------------------
  293. GET _ml/anomaly_detectors/low_request_rate/_stats
  294. --------------------------------------------------
  295. // TEST[skip:Kibana sample data]
  296. The API returns the following results:
  297. [source,js]
  298. ----
  299. {
  300. "count" : 1,
  301. "jobs" : [
  302. {
  303. "job_id" : "low_request_rate",
  304. "data_counts" : {
  305. "job_id" : "low_request_rate",
  306. "processed_record_count" : 1216,
  307. "processed_field_count" : 1216,
  308. "input_bytes" : 51678,
  309. "input_field_count" : 1216,
  310. "invalid_date_count" : 0,
  311. "missing_field_count" : 0,
  312. "out_of_order_timestamp_count" : 0,
  313. "empty_bucket_count" : 242,
  314. "sparse_bucket_count" : 0,
  315. "bucket_count" : 1457,
  316. "earliest_record_timestamp" : 1575172659612,
  317. "latest_record_timestamp" : 1580417369440,
  318. "last_data_time" : 1576017595046,
  319. "latest_empty_bucket_timestamp" : 1580356800000,
  320. "input_record_count" : 1216
  321. },
  322. "model_size_stats" : {
  323. "job_id" : "low_request_rate",
  324. "result_type" : "model_size_stats",
  325. "model_bytes" : 41480,
  326. "model_bytes_exceeded" : 0,
  327. "model_bytes_memory_limit" : 10485760,
  328. "total_by_field_count" : 3,
  329. "total_over_field_count" : 0,
  330. "total_partition_field_count" : 2,
  331. "bucket_allocation_failures_count" : 0,
  332. "memory_status" : "ok",
  333. "categorized_doc_count" : 0,
  334. "total_category_count" : 0,
  335. "frequent_category_count" : 0,
  336. "rare_category_count" : 0,
  337. "dead_category_count" : 0,
  338. "failed_category_count" : 0,
  339. "categorization_status" : "ok",
  340. "log_time" : 1576017596000,
  341. "timestamp" : 1580410800000
  342. },
  343. "forecasts_stats" : {
  344. "total" : 1,
  345. "forecasted_jobs" : 1,
  346. "memory_bytes" : {
  347. "total" : 9179.0,
  348. "min" : 9179.0,
  349. "avg" : 9179.0,
  350. "max" : 9179.0
  351. },
  352. "records" : {
  353. "total" : 168.0,
  354. "min" : 168.0,
  355. "avg" : 168.0,
  356. "max" : 168.0
  357. },
  358. "processing_time_ms" : {
  359. "total" : 40.0,
  360. "min" : 40.0,
  361. "avg" : 40.0,
  362. "max" : 40.0
  363. },
  364. "status" : {
  365. "finished" : 1
  366. }
  367. },
  368. "state" : "opened",
  369. "node" : {
  370. "id" : "7bmMXyWCRs-TuPfGJJ_yMw",
  371. "name" : "node-0",
  372. "ephemeral_id" : "hoXMLZB0RWKfR9UPPUCxXX",
  373. "transport_address" : "127.0.0.1:9300",
  374. "attributes" : {
  375. "ml.machine_memory" : "17179869184",
  376. "xpack.installed" : "true",
  377. "ml.max_open_jobs" : "512"
  378. }
  379. },
  380. "assignment_explanation" : "",
  381. "open_time" : "13s",
  382. "timing_stats" : {
  383. "job_id" : "low_request_rate",
  384. "bucket_count" : 1457,
  385. "total_bucket_processing_time_ms" : 1094.000000000001,
  386. "minimum_bucket_processing_time_ms" : 0.0,
  387. "maximum_bucket_processing_time_ms" : 48.0,
  388. "average_bucket_processing_time_ms" : 0.75085792724777,
  389. "exponential_average_bucket_processing_time_ms" : 0.5571716855800993,
  390. "exponential_average_bucket_processing_time_per_hour_ms" : 15.0
  391. }
  392. }
  393. ]
  394. }
  395. ----