update-job.asciidoc 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-update-job]]
  4. = Update {anomaly-jobs} API
  5. ++++
  6. <titleabbrev>Update jobs</titleabbrev>
  7. ++++
  8. Updates certain properties of an {anomaly-job}.
  9. [[ml-update-job-request]]
  10. == {api-request-title}
  11. `POST _ml/anomaly_detectors/<job_id>/_update`
  12. [[ml-update-job-prereqs]]
  13. == {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have `manage_ml` or
  15. `manage` cluster privileges to use this API. See
  16. <<security-privileges>> and {ml-docs-setup-privileges}.
  17. [[ml-update-job-path-parms]]
  18. == {api-path-parms-title}
  19. `<job_id>`::
  20. (Required, string)
  21. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  22. [role="child_attributes"]
  23. [[ml-update-job-request-body]]
  24. == {api-request-body-title}
  25. The following properties can be updated after the job is created:
  26. `allow_lazy_open`::
  27. (boolean)
  28. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-lazy-open]
  29. +
  30. --
  31. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  32. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  33. --
  34. //Begin analysis_limits
  35. [[update-analysislimits]]`analysis_limits`::
  36. (Optional, object)
  37. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=analysis-limits]
  38. +
  39. .Properties of `analysis_limits`
  40. [%collapsible%open]
  41. ====
  42. `model_memory_limit`:::
  43. (long or string)
  44. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-memory-limit]
  45. +
  46. --
  47. NOTE: You can update the `analysis_limits` only while the job is closed. The
  48. `model_memory_limit` property value cannot be decreased below the current usage.
  49. TIP: If the `memory_status` property in the
  50. <<ml-get-snapshot-results,`model_size_stats` object>> has a value of
  51. `hard_limit`,mthis means that it was unable to process some data. You might want
  52. to re-run the job with an increased `model_memory_limit`.
  53. --
  54. ====
  55. //End analysis_limits
  56. `background_persist_interval`::
  57. (<<time-units,time units>>)
  58. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=background-persist-interval]
  59. +
  60. --
  61. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  62. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  63. --
  64. [[update-customsettings]]`custom_settings`::
  65. (object)
  66. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-settings]
  67. `daily_model_snapshot_retention_after_days`::
  68. (long)
  69. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=daily-model-snapshot-retention-after-days]
  70. `description`::
  71. (string) A description of the job.
  72. //Begin detectors
  73. `detectors`::
  74. (array) An array of detector update objects.
  75. +
  76. .Properties of `detectors`
  77. [%collapsible%open]
  78. ====
  79. //Begin detectors.custom_rules
  80. `custom_rules`:::
  81. (array)
  82. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules]
  83. +
  84. .Properties of `custom_rules`
  85. [%collapsible%open]
  86. =====
  87. `actions`:::
  88. (array)
  89. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-actions]
  90. // Begin detectors.custom_rules.conditions
  91. `conditions`:::
  92. (array)
  93. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions]
  94. +
  95. .Properties of `conditions`
  96. [%collapsible%open]
  97. ======
  98. `applies_to`::::
  99. (string)
  100. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-applies-to]
  101. `operator`::::
  102. (string)
  103. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-operator]
  104. `value`::::
  105. (double)
  106. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-value]
  107. ======
  108. //End detectors.custom_rules.conditions
  109. //Begin detectors.custom_rules.scope
  110. `scope`:::
  111. (object)
  112. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-scope]
  113. +
  114. .Properties of `scope`
  115. [%collapsible%open]
  116. ======
  117. `filter_id`::::
  118. (string)
  119. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-id]
  120. `filter_type`::::
  121. (string)
  122. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-type]
  123. ======
  124. //End detectors.custom_rules.scope
  125. =====
  126. //End detectors.custom_rules
  127. `description`:::
  128. (string)
  129. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=detector-description]
  130. `detector_index`:::
  131. (integer)
  132. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=detector-index]
  133. +
  134. --
  135. If you want to update a specific detector, you must use this identifier. You
  136. cannot, however, change the `detector_index` value for a detector.
  137. --
  138. ====
  139. //End detectors
  140. `groups`::
  141. (array of strings)
  142. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=groups]
  143. //Begin model_plot_config
  144. `model_plot_config`::
  145. (object)
  146. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config]
  147. +
  148. .Properties of `model_plot_config`
  149. [%collapsible%open]
  150. ====
  151. `annotations_enabled`:::
  152. (boolean)
  153. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config-annotations-enabled]
  154. `enabled`:::
  155. (boolean)
  156. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config-enabled]
  157. `terms`:::
  158. experimental[] (string)
  159. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config-terms]
  160. ====
  161. //End model_plot_config
  162. `model_snapshot_retention_days`::
  163. (long)
  164. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
  165. //Begin per_partition_categorization
  166. `per_partition_categorization`:::
  167. (object)
  168. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=per-partition-categorization]
  169. +
  170. .Properties of `per_partition_categorization`
  171. [%collapsible%open]
  172. ====
  173. `enabled`:::
  174. (boolean)
  175. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=per-partition-categorization-enabled]
  176. `stop_on_warn`:::
  177. (boolean)
  178. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=per-partition-categorization-stop-on-warn]
  179. ====
  180. //End per_partition_categorization
  181. `renormalization_window_days`::
  182. (long)
  183. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  184. +
  185. --
  186. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  187. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  188. --
  189. `results_retention_days`::
  190. (long)
  191. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=results-retention-days]
  192. [[ml-update-job-example]]
  193. == {api-examples-title}
  194. [source,console]
  195. --------------------------------------------------
  196. POST _ml/anomaly_detectors/low_request_rate/_update
  197. {
  198. "description":"An updated job",
  199. "detectors": {
  200. "detector_index": 0,
  201. "description": "An updated detector description"
  202. },
  203. "groups": ["kibana_sample_data","kibana_sample_web_logs"],
  204. "model_plot_config": {
  205. "enabled": true
  206. },
  207. "renormalization_window_days": 30,
  208. "background_persist_interval": "2h",
  209. "model_snapshot_retention_days": 7,
  210. "results_retention_days": 60
  211. }
  212. --------------------------------------------------
  213. // TEST[skip:setup:Kibana sample data]
  214. When the {anomaly-job} is updated, you receive a summary of the job
  215. configuration information, including the updated property values. For example:
  216. [source,js]
  217. ----
  218. {
  219. "job_id" : "low_request_rate",
  220. "job_type" : "anomaly_detector",
  221. "job_version" : "8.0.0",
  222. "groups" : [
  223. "kibana_sample_data",
  224. "kibana_sample_web_logs"
  225. ],
  226. "description" : "An updated job",
  227. "create_time" : 1576623023709,
  228. "analysis_config" : {
  229. "bucket_span" : "1h",
  230. "summary_count_field_name" : "doc_count",
  231. "detectors" : [
  232. {
  233. "detector_description" : "An updated detector description",
  234. "function" : "low_count",
  235. "detector_index" : 0
  236. }
  237. ],
  238. "influencers" : [ ]
  239. },
  240. ...
  241. }
  242. ----