get-job-stats.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-job-stats]]
  4. === Get job statistics API
  5. ++++
  6. <titleabbrev>Get job statistics</titleabbrev>
  7. ++++
  8. Retrieves usage information for 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-desc]]
  16. ==== {api-description-title}
  17. You can get statistics for multiple jobs in a single API request by using a
  18. group name, a comma-separated list of jobs, or a wildcard expression. You can
  19. get statistics for all jobs by using `_all`, by specifying `*` as the
  20. `<job_id>`, or by omitting the `<job_id>`.
  21. IMPORTANT: This API returns a maximum of 10,000 jobs.
  22. [[ml-get-job-stats-path-parms]]
  23. ==== {api-path-parms-title}
  24. `job_id`::
  25. (string) An identifier for the job. It can be a job identifier, a group name,
  26. or a wildcard expression. If you do not specify one of these options, the API
  27. returns statistics for all jobs.
  28. [[ml-get-job-stats-results]]
  29. ==== {api-response-body-title}
  30. The API returns the following information:
  31. `jobs`::
  32. (array) An array of job statistics objects.
  33. For more information, see <<ml-jobstats,Job Statistics>>.
  34. [[ml-get-job-stats-prereqs]]
  35. ==== {api-prereq-title}
  36. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  37. privileges to use this API. For more information, see
  38. {stack-ov}/security-privileges.html[Security Privileges].
  39. [[ml-get-job-stats-example]]
  40. ==== {api-examples-title}
  41. The following example gets usage information for the `farequote` job:
  42. [source,js]
  43. --------------------------------------------------
  44. GET _ml/anomaly_detectors/farequote/_stats
  45. --------------------------------------------------
  46. // CONSOLE
  47. // TEST[skip:todo]
  48. The API returns the following results:
  49. [source,js]
  50. ----
  51. {
  52. "count": 1,
  53. "jobs": [
  54. {
  55. "job_id": "farequote",
  56. "data_counts": {
  57. "job_id": "farequote",
  58. "processed_record_count": 86275,
  59. "processed_field_count": 172550,
  60. "input_bytes": 6744714,
  61. "input_field_count": 172550,
  62. "invalid_date_count": 0,
  63. "missing_field_count": 0,
  64. "out_of_order_timestamp_count": 0,
  65. "empty_bucket_count": 0,
  66. "sparse_bucket_count": 15,
  67. "bucket_count": 1528,
  68. "earliest_record_timestamp": 1454803200000,
  69. "latest_record_timestamp": 1455235196000,
  70. "last_data_time": 1491948163685,
  71. "latest_sparse_bucket_timestamp": 1455174900000,
  72. "input_record_count": 86275
  73. },
  74. "model_size_stats": {
  75. "job_id": "farequote",
  76. "result_type": "model_size_stats",
  77. "model_bytes": 387594,
  78. "total_by_field_count": 21,
  79. "total_over_field_count": 0,
  80. "total_partition_field_count": 20,
  81. "bucket_allocation_failures_count": 0,
  82. "memory_status": "ok",
  83. "log_time": 1491948163000,
  84. "timestamp": 1455234600000
  85. },
  86. "state": "closed",
  87. "timing_stats": {
  88. "job_id": "farequote",
  89. "minimum_bucket_processing_time_ms": 0.0,
  90. "maximum_bucket_processing_time_ms": 15.0,
  91. "average_bucket_processing_time_ms": 8.75,
  92. "exponential_average_bucket_processing_time_ms": 6.1435899
  93. }
  94. }
  95. ]
  96. }
  97. ----