1
0

get-job.asciidoc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-job]]
  4. === Get {anomaly-jobs} API
  5. ++++
  6. <titleabbrev>Get jobs</titleabbrev>
  7. ++++
  8. Retrieves configuration information for {anomaly-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 {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 information 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-path-parms]]
  28. ==== {api-path-parms-title}
  29. `<job_id>`::
  30. (Optional, string) Identifier for the {anomaly-job}. It can be a job
  31. identifier, a group name, or a wildcard expression. If you do not specify one
  32. of these options, the API returns information for all {anomaly-jobs}.
  33. [[ml-get-job-query-parms]]
  34. ==== {api-query-parms-title}
  35. `allow_no_jobs`::
  36. (Optional, boolean) Specifies what to do when the request:
  37. +
  38. --
  39. * Contains wildcard expressions and there are no jobs that match.
  40. * Contains the `_all` string or no identifiers and there are no matches.
  41. * Contains wildcard expressions and there are only partial matches.
  42. The default value is `true`, which returns an empty `jobs` array
  43. when there are no matches and the subset of results when there are partial
  44. matches. If this parameter is `false`, the request returns a `404` status code
  45. when there are no matches or only partial matches.
  46. --
  47. [[ml-get-job-results]]
  48. ==== {api-response-body-title}
  49. The API returns the following information:
  50. `jobs`::
  51. (array) An array of {anomaly-job} resources.
  52. For more information, see <<ml-job-resource>>.
  53. [[ml-get-job-response-codes]]
  54. ==== {api-response-codes-title}
  55. `404` (Missing resources)::
  56. If `allow_no_jobs` is `false`, this code indicates that there are no
  57. resources that match the request or only partial matches for the request.
  58. [[ml-get-job-example]]
  59. ==== {api-examples-title}
  60. The following example gets configuration information for the `total-requests` job:
  61. [source,console]
  62. --------------------------------------------------
  63. GET _ml/anomaly_detectors/total-requests
  64. --------------------------------------------------
  65. // TEST[skip:setup:server_metrics_job]
  66. The API returns the following results:
  67. [source,console-result]
  68. ----
  69. {
  70. "count": 1,
  71. "jobs": [
  72. {
  73. "job_id": "total-requests",
  74. "job_type": "anomaly_detector",
  75. "job_version": "7.0.0-alpha1",
  76. "description": "Total sum of requests",
  77. "create_time": 1517011406091,
  78. "analysis_config": {
  79. "bucket_span": "10m",
  80. "detectors": [
  81. {
  82. "detector_description": "Sum of total",
  83. "function": "sum",
  84. "field_name": "total",
  85. "detector_index": 0
  86. }
  87. ],
  88. "influencers": [ ]
  89. },
  90. "analysis_limits": {
  91. "model_memory_limit": "1024mb",
  92. "categorization_examples_limit": 4
  93. },
  94. "data_description": {
  95. "time_field": "timestamp",
  96. "time_format": "epoch_ms"
  97. },
  98. "model_snapshot_retention_days": 1,
  99. "results_index_name": "shared"
  100. }
  101. ]
  102. }
  103. ----
  104. // TESTRESPONSE[s/"7.0.0-alpha1"/$body.$_path/]
  105. // TESTRESPONSE[s/1517011406091/$body.$_path/]