get-job.asciidoc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. <<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)
  31. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
  32. [[ml-get-job-query-parms]]
  33. ==== {api-query-parms-title}
  34. `allow_no_jobs`::
  35. (Optional, boolean)
  36. include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
  37. [[ml-get-job-results]]
  38. ==== {api-response-body-title}
  39. The API returns an array of {anomaly-job} resources, which have the following
  40. properties:
  41. `allow_lazy_open`::
  42. (boolean)
  43. include::{docdir}/ml/ml-shared.asciidoc[tag=allow-lazy-open]
  44. [[get-analysisconfig]]`analysis_config`::
  45. (object)
  46. include::{docdir}/ml/ml-shared.asciidoc[tag=analysis-config]
  47. [[get-analysislimits]]`analysis_limits`::
  48. (object)
  49. include::{docdir}/ml/ml-shared.asciidoc[tag=analysis-limits]
  50. `background_persist_interval`::
  51. (time units)
  52. include::{docdir}/ml/ml-shared.asciidoc[tag=background-persist-interval]
  53. `create_time`::
  54. (string) The time the job was created. For example, `1491007356077`. This
  55. property is informational; you cannot change its value.
  56. [[get-customsettings]]`custom_settings`::
  57. (object)
  58. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-settings]
  59. [[get-datadescription]]`data_description`::
  60. (object)
  61. include::{docdir}/ml/ml-shared.asciidoc[tag=data-description]
  62. `description`::
  63. (string) An optional description of the job.
  64. `finished_time`::
  65. (string) If the job closed or failed, this is the time the job finished,
  66. otherwise it is `null`. This property is informational; you cannot change its
  67. value.
  68. `groups`::
  69. (array of strings)
  70. include::{docdir}/ml/ml-shared.asciidoc[tag=groups]
  71. `job_id`::
  72. (string)
  73. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-define]
  74. +
  75. --
  76. This property is informational; you cannot change the identifier for existing
  77. jobs.
  78. --
  79. `job_type`::
  80. (string) Reserved for future use, currently set to `anomaly_detector`.
  81. `job_version`::
  82. (string) The version of {es} that existed on the node when the job was created.
  83. [[get-modelplotconfig]]`model_plot_config`::
  84. (object)
  85. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config]
  86. `model_snapshot_id`::
  87. (string)
  88. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
  89. +
  90. --
  91. This property is informational; you cannot change its value.
  92. --
  93. `model_snapshot_retention_days`::
  94. (long)
  95. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
  96. `renormalization_window_days`::
  97. (long)
  98. include::{docdir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  99. `results_index_name`::
  100. (string)
  101. include::{docdir}/ml/ml-shared.asciidoc[tag=results-index-name]
  102. [[ml-get-job-response-codes]]
  103. ==== {api-response-codes-title}
  104. `404` (Missing resources)::
  105. If `allow_no_jobs` is `false`, this code indicates that there are no
  106. resources that match the request or only partial matches for the request.
  107. [[ml-get-job-example]]
  108. ==== {api-examples-title}
  109. //The following example gets configuration information for the `total-requests` job:
  110. [source,console]
  111. --------------------------------------------------
  112. GET _ml/anomaly_detectors/high_sum_total_sales
  113. --------------------------------------------------
  114. // TEST[skip:Kibana sample data]
  115. The API returns the following results:
  116. [source,js]
  117. ----
  118. {
  119. "count": 1,
  120. "jobs": [
  121. {
  122. "job_id" : "high_sum_total_sales",
  123. "job_type" : "anomaly_detector",
  124. "job_version" : "8.0.0",
  125. "groups" : [
  126. "kibana_sample_data",
  127. "kibana_sample_ecommerce"
  128. ],
  129. "description" : "Find customers spending an unusually high amount in an hour",
  130. "create_time" : 1575402224732,
  131. "finished_time" : 1575402238311,
  132. "analysis_config" : {
  133. "bucket_span" : "1h",
  134. "detectors" : [
  135. {
  136. "detector_description" : "High total sales",
  137. "function" : "high_sum",
  138. "field_name" : "taxful_total_price",
  139. "over_field_name" : "customer_full_name.keyword",
  140. "detector_index" : 0
  141. }
  142. ],
  143. "influencers" : [
  144. "customer_full_name.keyword",
  145. "category.keyword"
  146. ]
  147. },
  148. "analysis_limits" : {
  149. "model_memory_limit" : "10mb",
  150. "categorization_examples_limit" : 4
  151. },
  152. "data_description" : {
  153. "time_field" : "order_date",
  154. "time_format" : "epoch_ms"
  155. },
  156. "model_plot_config" : {
  157. "enabled" : true
  158. },
  159. "model_snapshot_retention_days" : 1,
  160. "custom_settings" : {
  161. "created_by" : "ml-module-sample",
  162. ...
  163. },
  164. "model_snapshot_id" : "1575402237",
  165. "results_index_name" : "shared",
  166. "allow_lazy_open" : false
  167. }
  168. ]
  169. }
  170. ----