get-job.asciidoc 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. [[ml-get-job-results]]
  40. == {api-response-body-title}
  41. The API returns an array of {anomaly-job} resources. For the full list of
  42. properties, see <<ml-put-job-request-body,create {anomaly-jobs} API>>.
  43. //Begin blocked
  44. `blocked`::
  45. (object) When present, it explains that a task is executed on the job
  46. that blocks it from opening.
  47. +
  48. .Properties of `blocked`
  49. [%collapsible%open]
  50. ====
  51. `reason`:::
  52. (string) The reason the job is blocked. Values may be `delete`, `reset`, `revert`.
  53. Each value means the corresponding action is being executed.
  54. `task_id`:::
  55. (string) The task id of the blocking action. You can use the <<tasks>> API to
  56. monitor progress.
  57. ====
  58. //End blocked
  59. `create_time`::
  60. (string) The time the job was created. For example, `1491007356077`. This
  61. property is informational; you cannot change its value.
  62. `datafeed_config`::
  63. (object) The {dfeed} configured for the current {anomaly-job}.
  64. +
  65. .Properties of `datafeed_config`
  66. [%collapsible%open]
  67. ====
  68. `datafeed_id`:::
  69. (Optional, string)
  70. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=datafeed-id]
  71. `aggregations`:::
  72. (Optional, object)
  73. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=aggregations]
  74. `chunking_config`:::
  75. (Optional, object)
  76. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=chunking-config]
  77. +
  78. .Properties of `chunking_config`
  79. [%collapsible%open]
  80. =====
  81. `mode`:::
  82. (string)
  83. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=mode]
  84. `time_span`:::
  85. (<<time-units,time units>>)
  86. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=time-span]
  87. =====
  88. `delayed_data_check_config`:::
  89. (Optional, object)
  90. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config]
  91. +
  92. .Properties of `delayed_data_check_config`
  93. [%collapsible%open]
  94. =====
  95. `check_window`::
  96. (<<time-units,time units>>)
  97. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-check-window]
  98. `enabled`::
  99. (Boolean)
  100. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=delayed-data-check-config-enabled]
  101. =====
  102. `frequency`:::
  103. (Optional, <<time-units, time units>>)
  104. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequency]
  105. `indices`:::
  106. (Required, array)
  107. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices]
  108. `indices_options`:::
  109. (Optional, object)
  110. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=indices-options]
  111. `job_id`:::
  112. (Required, string)
  113. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  114. `max_empty_searches`:::
  115. (Optional,integer)
  116. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=max-empty-searches]
  117. `query`:::
  118. (Optional, object)
  119. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query]
  120. `query_delay`:::
  121. (Optional, <<time-units, time units>>)
  122. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=query-delay]
  123. `runtime_mappings`:::
  124. (Optional, object)
  125. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=runtime-mappings]
  126. `script_fields`:::
  127. (Optional, object)
  128. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=script-fields]
  129. `scroll_size`:::
  130. (Optional, unsigned integer)
  131. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=scroll-size]
  132. ====
  133. `finished_time`::
  134. (string) If the job closed or failed, this is the time the job finished,
  135. otherwise it is `null`. This property is informational; you cannot change its
  136. value.
  137. `job_type`::
  138. (string) Reserved for future use, currently set to `anomaly_detector`.
  139. `job_version`::
  140. (string) The version of {es} that existed on the node when the job was created.
  141. `model_snapshot_id`::
  142. (string)
  143. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
  144. [[ml-get-job-response-codes]]
  145. == {api-response-codes-title}
  146. `404` (Missing resources)::
  147. If `allow_no_match` is `false`, this code indicates that there are no
  148. resources that match the request or only partial matches for the request.
  149. [[ml-get-job-example]]
  150. == {api-examples-title}
  151. [source,console]
  152. --------------------------------------------------
  153. GET _ml/anomaly_detectors/high_sum_total_sales
  154. --------------------------------------------------
  155. // TEST[skip:Kibana sample data]
  156. The API returns the following results:
  157. [source,js]
  158. ----
  159. {
  160. "count": 1,
  161. "jobs": [
  162. {
  163. "job_id" : "high_sum_total_sales",
  164. "job_type" : "anomaly_detector",
  165. "job_version" : "8.0.0",
  166. "groups" : [
  167. "kibana_sample_data",
  168. "kibana_sample_ecommerce"
  169. ],
  170. "description" : "Find customers spending an unusually high amount in an hour",
  171. "create_time" : 1575402224732,
  172. "finished_time" : 1575402238311,
  173. "analysis_config" : {
  174. "bucket_span" : "1h",
  175. "detectors" : [
  176. {
  177. "detector_description" : "High total sales",
  178. "function" : "high_sum",
  179. "field_name" : "taxful_total_price",
  180. "over_field_name" : "customer_full_name.keyword",
  181. "detector_index" : 0
  182. }
  183. ],
  184. "influencers" : [
  185. "customer_full_name.keyword",
  186. "category.keyword"
  187. ]
  188. },
  189. "analysis_limits" : {
  190. "model_memory_limit" : "10mb",
  191. "categorization_examples_limit" : 4
  192. },
  193. "data_description" : {
  194. "time_field" : "order_date",
  195. "time_format" : "epoch_ms"
  196. },
  197. "model_plot_config" : {
  198. "enabled" : true
  199. },
  200. "model_snapshot_retention_days" : 10,
  201. "daily_model_snapshot_retention_after_days" : 1,
  202. "custom_settings" : {
  203. "created_by" : "ml-module-sample",
  204. ...
  205. },
  206. "model_snapshot_id" : "1575402237",
  207. "results_index_name" : "shared",
  208. "allow_lazy_open" : false
  209. }
  210. ]
  211. }
  212. ----