update-job.asciidoc 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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::{docdir}/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::{docdir}/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::{docdir}/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::{docdir}/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::{docdir}/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::{docdir}/ml/ml-shared.asciidoc[tag=custom-settings]
  67. `description`::
  68. (string) A description of the job.
  69. //Begin detectors
  70. `detectors`::
  71. (array) An array of detector update objects.
  72. +
  73. .Properties of `detectors`
  74. [%collapsible%open]
  75. ====
  76. //Begin detectors.custom_rules
  77. `custom_rules`:::
  78. (array)
  79. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules]
  80. +
  81. .Properties of `custom_rules`
  82. [%collapsible%open]
  83. =====
  84. `actions`:::
  85. (array)
  86. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-actions]
  87. // Begin detectors.custom_rules.conditions
  88. `conditions`:::
  89. (array)
  90. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions]
  91. +
  92. .Properties of `conditions`
  93. [%collapsible%open]
  94. ======
  95. `applies_to`::::
  96. (string)
  97. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-applies-to]
  98. `operator`::::
  99. (string)
  100. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-operator]
  101. `value`::::
  102. (double)
  103. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-value]
  104. ======
  105. //End detectors.custom_rules.conditions
  106. //Begin detectors.custom_rules.scope
  107. `scope`:::
  108. (object)
  109. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope]
  110. +
  111. .Properties of `scope`
  112. [%collapsible%open]
  113. ======
  114. `filter_id`::::
  115. (string)
  116. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-id]
  117. `filter_type`::::
  118. (string)
  119. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-type]
  120. ======
  121. //End detectors.custom_rules.scope
  122. =====
  123. //End detectors.custom_rules
  124. `description`:::
  125. (string)
  126. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-description]
  127. `detector_index`:::
  128. (integer)
  129. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-index]
  130. +
  131. --
  132. If you want to update a specific detector, you must use this identifier. You
  133. cannot, however, change the `detector_index` value for a detector.
  134. --
  135. ====
  136. //End detectors
  137. `groups`::
  138. (array of strings)
  139. include::{docdir}/ml/ml-shared.asciidoc[tag=groups]
  140. //Begin model_plot_config
  141. `model_plot_config`::
  142. (object)
  143. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config]
  144. +
  145. .Properties of `model_plot_config`
  146. [%collapsible%open]
  147. ====
  148. `enabled`:::
  149. (boolean)
  150. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-enabled]
  151. `terms`:::
  152. experimental[] (string)
  153. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-terms]
  154. ====
  155. //End model_plot_config
  156. `model_snapshot_retention_days`::
  157. (long)
  158. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
  159. `renormalization_window_days`::
  160. (long)
  161. include::{docdir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  162. +
  163. --
  164. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  165. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  166. --
  167. `results_retention_days`::
  168. (long)
  169. include::{docdir}/ml/ml-shared.asciidoc[tag=results-retention-days]
  170. [[ml-update-job-example]]
  171. ==== {api-examples-title}
  172. [source,console]
  173. --------------------------------------------------
  174. POST _ml/anomaly_detectors/low_request_rate/_update
  175. {
  176. "description":"An updated job",
  177. "detectors": {
  178. "detector_index": 0,
  179. "description": "An updated detector description"
  180. },
  181. "groups": ["kibana_sample_data","kibana_sample_web_logs"],
  182. "model_plot_config": {
  183. "enabled": true
  184. },
  185. "renormalization_window_days": 30,
  186. "background_persist_interval": "2h",
  187. "model_snapshot_retention_days": 7,
  188. "results_retention_days": 60
  189. }
  190. --------------------------------------------------
  191. // TEST[skip:setup:Kibana sample data]
  192. When the {anomaly-job} is updated, you receive a summary of the job
  193. configuration information, including the updated property values. For example:
  194. [source,js]
  195. ----
  196. {
  197. "job_id" : "low_request_rate",
  198. "job_type" : "anomaly_detector",
  199. "job_version" : "8.0.0",
  200. "groups" : [
  201. "kibana_sample_data",
  202. "kibana_sample_web_logs"
  203. ],
  204. "description" : "An updated job",
  205. "create_time" : 1576623023709,
  206. "analysis_config" : {
  207. "bucket_span" : "1h",
  208. "summary_count_field_name" : "doc_count",
  209. "detectors" : [
  210. {
  211. "detector_description" : "An updated detector description",
  212. "function" : "low_count",
  213. "detector_index" : 0
  214. }
  215. ],
  216. "influencers" : [ ]
  217. },
  218. ...
  219. }
  220. ----