update-job.asciidoc 7.4 KB

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