get-job-stats.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. ==== Request
  10. `GET _ml/anomaly_detectors/<job_id>/_stats`
  11. `GET _ml/anomaly_detectors/<job_id>,<job_id>/_stats` +
  12. `GET _ml/anomaly_detectors/_stats` +
  13. `GET _ml/anomaly_detectors/_all/_stats` +
  14. ===== Description
  15. You can get statistics for multiple jobs in a single API request by using a
  16. group name, a comma-separated list of jobs, or a wildcard expression. You can
  17. get statistics for all jobs by using `_all`, by specifying `*` as the
  18. `<job_id>`, or by omitting the `<job_id>`.
  19. IMPORTANT: This API returns a maximum of 10,000 jobs.
  20. ==== Path Parameters
  21. `job_id`::
  22. (string) An identifier for the job. It can be a job identifier, a group name,
  23. or a wildcard expression. If you do not specify one of these options, the API
  24. returns statistics for all jobs.
  25. ==== Results
  26. The API returns the following information:
  27. `jobs`::
  28. (array) An array of job statistics objects.
  29. For more information, see <<ml-jobstats,Job Statistics>>.
  30. ==== Authorization
  31. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  32. privileges to use this API. For more information, see
  33. {xpack-ref}/security-privileges.html[Security Privileges].
  34. ==== Examples
  35. The following example gets usage information for the `farequote` job:
  36. [source,js]
  37. --------------------------------------------------
  38. GET _ml/anomaly_detectors/farequote/_stats
  39. --------------------------------------------------
  40. // CONSOLE
  41. // TEST[skip:todo]
  42. The API returns the following results:
  43. [source,js]
  44. ----
  45. {
  46. "count": 1,
  47. "jobs": [
  48. {
  49. "job_id": "farequote",
  50. "data_counts": {
  51. "job_id": "farequote",
  52. "processed_record_count": 86275,
  53. "processed_field_count": 172550,
  54. "input_bytes": 6744714,
  55. "input_field_count": 172550,
  56. "invalid_date_count": 0,
  57. "missing_field_count": 0,
  58. "out_of_order_timestamp_count": 0,
  59. "empty_bucket_count": 0,
  60. "sparse_bucket_count": 15,
  61. "bucket_count": 1528,
  62. "earliest_record_timestamp": 1454803200000,
  63. "latest_record_timestamp": 1455235196000,
  64. "last_data_time": 1491948163685,
  65. "latest_sparse_bucket_timestamp": 1455174900000,
  66. "input_record_count": 86275
  67. },
  68. "model_size_stats": {
  69. "job_id": "farequote",
  70. "result_type": "model_size_stats",
  71. "model_bytes": 387594,
  72. "total_by_field_count": 21,
  73. "total_over_field_count": 0,
  74. "total_partition_field_count": 20,
  75. "bucket_allocation_failures_count": 0,
  76. "memory_status": "ok",
  77. "log_time": 1491948163000,
  78. "timestamp": 1455234600000
  79. },
  80. "state": "closed"
  81. }
  82. ]
  83. }
  84. ----