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