get-job.asciidoc 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. [role="xpack"]
  2. [[ml-get-job]]
  3. = Get {anomaly-jobs} API
  4. ++++
  5. <titleabbrev>Get jobs</titleabbrev>
  6. ++++
  7. Retrieves configuration information for {anomaly-jobs}.
  8. [[ml-get-job-request]]
  9. == {api-request-title}
  10. `GET _ml/anomaly_detectors/<job_id>` +
  11. `GET _ml/anomaly_detectors/<job_id>,<job_id>` +
  12. `GET _ml/anomaly_detectors/` +
  13. `GET _ml/anomaly_detectors/_all`
  14. [[ml-get-job-prereqs]]
  15. == {api-prereq-title}
  16. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  17. `machine_learning_user` built-in role.
  18. [[ml-get-job-desc]]
  19. == {api-description-title}
  20. IMPORTANT: This API returns a maximum of 10,000 jobs.
  21. [[ml-get-job-path-parms]]
  22. == {api-path-parms-title}
  23. `<job_id>`::
  24. (Optional, string)
  25. Identifier for the anomaly detection job. It can be a job identifier, a group
  26. name, or a wildcard expression. You can get information for multiple
  27. {anomaly-jobs} in a single API request by using a group name, a comma-separated
  28. list of jobs, or a wildcard expression. You can get information for all
  29. {anomaly-jobs} by using `_all`, by specifying `*` as the job identifier, or by
  30. omitting the identifier.
  31. [[ml-get-job-query-parms]]
  32. == {api-query-parms-title}
  33. `allow_no_match`::
  34. (Optional, Boolean)
  35. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-match-jobs]
  36. `exclude_generated`::
  37. (Optional, Boolean)
  38. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=exclude-generated]
  39. [role="child_attributes"]
  40. [[ml-get-job-results]]
  41. == {api-response-body-title}
  42. The API returns an array of {anomaly-job} resources. For the full list of
  43. properties, see <<ml-put-job-request-body,create {anomaly-jobs} API>>.
  44. //Begin blocked
  45. `blocked`::
  46. (object) When present, it explains that a task is executed on the job
  47. that blocks it from opening.
  48. +
  49. .Properties of `blocked`
  50. [%collapsible%open]
  51. ====
  52. `reason`:::
  53. (string) The reason the job is blocked. Values may be `delete`, `reset`, `revert`.
  54. Each value means the corresponding action is being executed.
  55. `task_id`:::
  56. (string) The task id of the blocking action. You can use the <<tasks>> API to
  57. monitor progress.
  58. ====
  59. //End blocked
  60. `create_time`::
  61. (string) The time the job was created. For example, `1491007356077`. This
  62. property is informational; you cannot change its value.
  63. `datafeed_config`::
  64. (object) The {dfeed} configured for the current {anomaly-job}.
  65. +
  66. .Properties of `datafeed_config`
  67. [%collapsible%open]
  68. ====
  69. `authorization`:::
  70. (Optional, object)
  71. The security privileges that the {dfeed} uses to run its queries. If
  72. {stack-security-features} were disabled at the time of the most recent update to
  73. the {dfeed}, this property is omitted.
  74. +
  75. .Properties of `authorization`
  76. [%collapsible%open]
  77. =====
  78. `api_key`:::
  79. (object) If an API key was used for the most recent update to the {dfeed}, its
  80. name and identifier are listed in the response.
  81. +
  82. .Properties of `api_key`
  83. [%collapsible%open]
  84. ======
  85. `id`::::
  86. (string) The identifier for the API key.
  87. `name`::::
  88. (string) The name of the API key.
  89. ======
  90. `roles`:::
  91. (array of strings) If a user ID was used for the most recent update to the
  92. {dfeed}, its roles at the time of the update are listed in the response.
  93. `service_account`:::
  94. (string) If a service account was used for the most recent update to the {dfeed},
  95. the account name is listed in the response.
  96. =====
  97. `datafeed_id`:::
  98. (Optional, string)
  99. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  100. `aggregations`:::
  101. (Optional, object)
  102. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=aggregations]
  103. `chunking_config`:::
  104. (Optional, object)
  105. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=chunking-config]
  106. +
  107. .Properties of `chunking_config`
  108. [%collapsible%open]
  109. =====
  110. `mode`:::
  111. (string)
  112. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=mode]
  113. `time_span`:::
  114. (<<time-units,time units>>)
  115. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=time-span]
  116. =====
  117. `delayed_data_check_config`:::
  118. (Optional, object)
  119. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
  120. +
  121. .Properties of `delayed_data_check_config`
  122. [%collapsible%open]
  123. =====
  124. `check_window`::
  125. (<<time-units,time units>>)
  126. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-check-window]
  127. `enabled`::
  128. (Boolean)
  129. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-enabled]
  130. =====
  131. `frequency`:::
  132. (Optional, <<time-units, time units>>)
  133. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequency]
  134. `indices`:::
  135. (Required, array)
  136. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices]
  137. `indices_options`:::
  138. (Optional, object)
  139. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices-options]
  140. `job_id`:::
  141. (Required, string)
  142. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  143. `max_empty_searches`:::
  144. (Optional,integer)
  145. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
  146. `query`:::
  147. (Optional, object)
  148. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query]
  149. `query_delay`:::
  150. (Optional, <<time-units, time units>>)
  151. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query-delay]
  152. `runtime_mappings`:::
  153. (Optional, object)
  154. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=runtime-mappings]
  155. `script_fields`:::
  156. (Optional, object)
  157. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=script-fields]
  158. `scroll_size`:::
  159. (Optional, unsigned integer)
  160. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=scroll-size]
  161. ====
  162. `finished_time`::
  163. (string) If the job closed or failed, this is the time the job finished,
  164. otherwise it is `null`. This property is informational; you cannot change its
  165. value.
  166. `job_type`::
  167. (string) Reserved for future use, currently set to `anomaly_detector`.
  168. `job_version`::
  169. (string) The version of {es} that existed on the node when the job was created.
  170. `model_snapshot_id`::
  171. (string)
  172. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
  173. [[ml-get-job-response-codes]]
  174. == {api-response-codes-title}
  175. `404` (Missing resources)::
  176. If `allow_no_match` is `false`, this code indicates that there are no
  177. resources that match the request or only partial matches for the request.
  178. [[ml-get-job-example]]
  179. == {api-examples-title}
  180. [source,console]
  181. --------------------------------------------------
  182. GET _ml/anomaly_detectors/high_sum_total_sales
  183. --------------------------------------------------
  184. // TEST[skip:Kibana sample data]
  185. The API returns the following results:
  186. [source,js]
  187. ----
  188. {
  189. "count": 1,
  190. "jobs": [
  191. {
  192. "job_id" : "high_sum_total_sales",
  193. "job_type" : "anomaly_detector",
  194. "job_version" : "8.4.0",
  195. "create_time" : 1655852735889,
  196. "finished_time" : 1655852745980,
  197. "model_snapshot_id" : "1575402237",
  198. "custom_settings" : {
  199. "created_by" : "ml-module-sample",
  200. ...
  201. },
  202. "datafeed_config" : {
  203. "datafeed_id" : "datafeed-high_sum_total_sales",
  204. "job_id" : "high_sum_total_sales",
  205. "authorization" : {
  206. "roles" : [
  207. "superuser"
  208. ]
  209. },
  210. "query_delay" : "93169ms",
  211. "chunking_config" : {
  212. "mode" : "auto"
  213. },
  214. "indices_options" : {
  215. "expand_wildcards" : [
  216. "open"
  217. ],
  218. "ignore_unavailable" : false,
  219. "allow_no_indices" : true,
  220. "ignore_throttled" : true
  221. },
  222. "query" : {
  223. "bool" : {
  224. "filter" : [
  225. {
  226. "term" : {
  227. "event.dataset" : "sample_ecommerce"
  228. }
  229. }
  230. ]
  231. }
  232. },
  233. "indices" : [
  234. "kibana_sample_data_ecommerce"
  235. ],
  236. "scroll_size" : 1000,
  237. "delayed_data_check_config" : {
  238. "enabled" : true
  239. }
  240. },
  241. "groups" : [
  242. "kibana_sample_data",
  243. "kibana_sample_ecommerce"
  244. ],
  245. "description" : "Find customers spending an unusually high amount in an hour",
  246. "analysis_config" : {
  247. "bucket_span" : "1h",
  248. "detectors" : [
  249. {
  250. "detector_description" : "High total sales",
  251. "function" : "high_sum",
  252. "field_name" : "taxful_total_price",
  253. "over_field_name" : "customer_full_name.keyword",
  254. "detector_index" : 0
  255. }
  256. ],
  257. "influencers" : [
  258. "customer_full_name.keyword",
  259. "category.keyword"
  260. ],
  261. "model_prune_window": "30d"
  262. },
  263. "analysis_limits" : {
  264. "model_memory_limit" : "13mb",
  265. "categorization_examples_limit" : 4
  266. },
  267. "data_description" : {
  268. "time_field" : "order_date",
  269. "time_format" : "epoch_ms"
  270. },
  271. "model_plot_config" : {
  272. "enabled" : true,
  273. "annotations_enabled" : true
  274. },
  275. "model_snapshot_retention_days" : 10,
  276. "daily_model_snapshot_retention_after_days" : 1,
  277. "results_index_name" : "shared",
  278. "allow_lazy_open" : false
  279. }
  280. ]
  281. }
  282. ----