update-job.asciidoc 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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>>.
  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. `renormalization_window_days`::
  166. (long)
  167. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  168. +
  169. --
  170. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  171. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  172. --
  173. `results_retention_days`::
  174. (long)
  175. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=results-retention-days]
  176. [[ml-update-job-example]]
  177. ==== {api-examples-title}
  178. [source,console]
  179. --------------------------------------------------
  180. POST _ml/anomaly_detectors/low_request_rate/_update
  181. {
  182. "description":"An updated job",
  183. "detectors": {
  184. "detector_index": 0,
  185. "description": "An updated detector description"
  186. },
  187. "groups": ["kibana_sample_data","kibana_sample_web_logs"],
  188. "model_plot_config": {
  189. "enabled": true
  190. },
  191. "renormalization_window_days": 30,
  192. "background_persist_interval": "2h",
  193. "model_snapshot_retention_days": 7,
  194. "results_retention_days": 60
  195. }
  196. --------------------------------------------------
  197. // TEST[skip:setup:Kibana sample data]
  198. When the {anomaly-job} is updated, you receive a summary of the job
  199. configuration information, including the updated property values. For example:
  200. [source,js]
  201. ----
  202. {
  203. "job_id" : "low_request_rate",
  204. "job_type" : "anomaly_detector",
  205. "job_version" : "8.0.0",
  206. "groups" : [
  207. "kibana_sample_data",
  208. "kibana_sample_web_logs"
  209. ],
  210. "description" : "An updated job",
  211. "create_time" : 1576623023709,
  212. "analysis_config" : {
  213. "bucket_span" : "1h",
  214. "summary_count_field_name" : "doc_count",
  215. "detectors" : [
  216. {
  217. "detector_description" : "An updated detector description",
  218. "function" : "low_count",
  219. "detector_index" : 0
  220. }
  221. ],
  222. "influencers" : [ ]
  223. },
  224. ...
  225. }
  226. ----