1
0

get-job.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-job]]
  4. === Get jobs API
  5. ++++
  6. <titleabbrev>Get jobs</titleabbrev>
  7. ++++
  8. Retrieves configuration information for jobs.
  9. [[ml-get-job-request]]
  10. ==== {api-request-title}
  11. `GET _ml/anomaly_detectors/<job_id>` +
  12. `GET _ml/anomaly_detectors/<job_id>,<job_id>` +
  13. `GET _ml/anomaly_detectors/` +
  14. `GET _ml/anomaly_detectors/_all`
  15. [[ml-get-job-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. {stack-ov}/security-privileges.html[Security privileges].
  20. [[ml-get-job-desc]]
  21. ==== {api-description-title}
  22. You can get information for multiple jobs in a single API request by using a
  23. group name, a comma-separated list of jobs, or a wildcard expression. You can
  24. get information for all jobs by using `_all`, by specifying `*` as the
  25. `<job_id>`, or by omitting the `<job_id>`.
  26. IMPORTANT: This API returns a maximum of 10,000 jobs.
  27. [[ml-get-job-path-parms]]
  28. ==== {api-path-parms-title}
  29. `<job_id> (Optional)`::
  30. (string) Identifier for the job. It can be a job identifier, a group name,
  31. or a wildcard expression. If you do not specify one of these options, the API
  32. returns information for all jobs.
  33. [[ml-get-job-results]]
  34. ==== {api-response-body-title}
  35. The API returns the following information:
  36. `jobs`::
  37. (array) An array of job resources.
  38. For more information, see <<ml-job-resource,Job Resources>>.
  39. [[ml-get-job-example]]
  40. ==== {api-examples-title}
  41. The following example gets configuration information for the `total-requests` job:
  42. [source,js]
  43. --------------------------------------------------
  44. GET _ml/anomaly_detectors/total-requests
  45. --------------------------------------------------
  46. // CONSOLE
  47. // TEST[skip:setup:server_metrics_job]
  48. The API returns the following results:
  49. [source,js]
  50. ----
  51. {
  52. "count": 1,
  53. "jobs": [
  54. {
  55. "job_id": "total-requests",
  56. "job_type": "anomaly_detector",
  57. "job_version": "7.0.0-alpha1",
  58. "description": "Total sum of requests",
  59. "create_time": 1517011406091,
  60. "analysis_config": {
  61. "bucket_span": "10m",
  62. "detectors": [
  63. {
  64. "detector_description": "Sum of total",
  65. "function": "sum",
  66. "field_name": "total",
  67. "detector_index": 0
  68. }
  69. ],
  70. "influencers": [ ]
  71. },
  72. "analysis_limits": {
  73. "model_memory_limit": "1024mb",
  74. "categorization_examples_limit": 4
  75. },
  76. "data_description": {
  77. "time_field": "timestamp",
  78. "time_format": "epoch_ms"
  79. },
  80. "model_snapshot_retention_days": 1,
  81. "results_index_name": "shared"
  82. }
  83. ]
  84. }
  85. ----
  86. // TESTRESPONSE[s/"7.0.0-alpha1"/$body.$_path/]
  87. // TESTRESPONSE[s/1517011406091/$body.$_path/]