update-job.asciidoc 7.1 KB

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