update-job.asciidoc 7.3 KB

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