get-job-stats.asciidoc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. * If the {es} {security-features} are enabled, you must have `monitor_ml`,
  18. `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
  19. <<security-privileges>>.
  20. [[ml-get-job-stats-desc]]
  21. ==== {api-description-title}
  22. You can get statistics for multiple {anomaly-jobs} in a single API request by
  23. using a group name, a comma-separated list of jobs, or a wildcard expression.
  24. You can get statistics for all {anomaly-jobs} by using `_all`, by specifying `*`
  25. as the `<job_id>`, or by omitting the `<job_id>`.
  26. IMPORTANT: This API returns a maximum of 10,000 jobs.
  27. [[ml-get-job-stats-path-parms]]
  28. ==== {api-path-parms-title}
  29. `<job_id>`::
  30. (Optional, string)
  31. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
  32. [[ml-get-job-stats-query-parms]]
  33. ==== {api-query-parms-title}
  34. `allow_no_jobs`::
  35. (Optional, boolean)
  36. include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
  37. [[ml-get-job-stats-results]]
  38. ==== {api-response-body-title}
  39. The API returns the following information:
  40. `jobs`::
  41. (array)
  42. include::{docdir}/ml/ml-shared.asciidoc[tag=jobs-stats-anomaly-detection]
  43. [[ml-get-job-stats-response-codes]]
  44. ==== {api-response-codes-title}
  45. `404` (Missing resources)::
  46. If `allow_no_jobs` is `false`, this code indicates that there are no
  47. resources that match the request or only partial matches for the request.
  48. [[ml-get-job-stats-example]]
  49. ==== {api-examples-title}
  50. The following example gets usage information for the `farequote` job:
  51. [source,console]
  52. --------------------------------------------------
  53. GET _ml/anomaly_detectors/farequote/_stats
  54. --------------------------------------------------
  55. // TEST[skip:todo]
  56. The API returns the following results:
  57. [source,js]
  58. ----
  59. {
  60. "count": 1,
  61. "jobs": [
  62. {
  63. "job_id": "farequote",
  64. "data_counts": {
  65. "job_id": "farequote",
  66. "processed_record_count": 86275,
  67. "processed_field_count": 172550,
  68. "input_bytes": 6744714,
  69. "input_field_count": 172550,
  70. "invalid_date_count": 0,
  71. "missing_field_count": 0,
  72. "out_of_order_timestamp_count": 0,
  73. "empty_bucket_count": 0,
  74. "sparse_bucket_count": 15,
  75. "bucket_count": 1528,
  76. "earliest_record_timestamp": 1454803200000,
  77. "latest_record_timestamp": 1455235196000,
  78. "last_data_time": 1491948163685,
  79. "latest_sparse_bucket_timestamp": 1455174900000,
  80. "input_record_count": 86275
  81. },
  82. "model_size_stats": {
  83. "job_id": "farequote",
  84. "result_type": "model_size_stats",
  85. "model_bytes": 387594,
  86. "total_by_field_count": 21,
  87. "total_over_field_count": 0,
  88. "total_partition_field_count": 20,
  89. "bucket_allocation_failures_count": 0,
  90. "memory_status": "ok",
  91. "log_time": 1491948163000,
  92. "timestamp": 1455234600000
  93. },
  94. "state": "closed",
  95. "timing_stats": {
  96. "job_id": "farequote",
  97. "minimum_bucket_processing_time_ms": 0.0,
  98. "maximum_bucket_processing_time_ms": 15.0,
  99. "average_bucket_processing_time_ms": 8.75,
  100. "exponential_average_bucket_processing_time_ms": 6.1435899
  101. }
  102. }
  103. ]
  104. }
  105. ----