update-job.asciidoc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. [[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::{docdir}/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. [[update-analysislimits]]`analysis_limits`.`model_memory_limit`::
  34. (long or string)
  35. include::{docdir}/ml/ml-shared.asciidoc[tag=model-memory-limit]
  36. +
  37. --
  38. NOTE: You can update the `analysis_limits` only while the job is closed. The
  39. `model_memory_limit` property value cannot be decreased below the current usage.
  40. TIP: If the `memory_status` property in the
  41. <<ml-get-snapshot-results,`model_size_stats` object>> has a value of `hard_limit`,
  42. this means that it was unable to process some data. You might want to re-run the
  43. job with an increased `model_memory_limit`.
  44. --
  45. `background_persist_interval`::
  46. (<<time-units,time units>>)
  47. include::{docdir}/ml/ml-shared.asciidoc[tag=background-persist-interval]
  48. +
  49. --
  50. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  51. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  52. --
  53. [[update-customsettings]]`custom_settings`::
  54. (object)
  55. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-settings]
  56. `description`::
  57. (string) A description of the job.
  58. `detectors`::
  59. (array) An array of detector update objects.
  60. `detectors`.`custom_rules`:::
  61. +
  62. --
  63. (array)
  64. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules]
  65. `detectors`.`custom_rules`.`actions`:::
  66. (array)
  67. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-actions]
  68. `detectors`.`custom_rules`.`scope`:::
  69. (object)
  70. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope]
  71. `detectors`.`custom_rules`.`scope`.`filter_id`::::
  72. (string)
  73. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-id]
  74. `detectors`.`custom_rules`.`scope`.`filter_type`::::
  75. (string)
  76. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-type]
  77. `detectors`.`custom_rules`.`conditions`:::
  78. (array)
  79. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions]
  80. `detectors`.`custom_rules`.`conditions`.`applies_to`::::
  81. (string)
  82. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-applies-to]
  83. `detectors`.`custom_rules`.`conditions`.`operator`::::
  84. (string)
  85. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-operator]
  86. `detectors`.`custom_rules`.`conditions`.`value`::::
  87. (double)
  88. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-value]
  89. --
  90. `detectors`.`description`:::
  91. (string)
  92. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-description]
  93. `detectors`.`detector_index`:::
  94. +
  95. --
  96. (integer)
  97. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-index]
  98. If you want to update a specific detector, you must use this identifier. You
  99. cannot, however, change the `detector_index` value for a detector.
  100. --
  101. `groups`::
  102. (array of strings)
  103. include::{docdir}/ml/ml-shared.asciidoc[tag=groups]
  104. `model_plot_config`::
  105. (object)
  106. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config]
  107. `model_plot_config`.`enabled`:::
  108. (boolean)
  109. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-enabled]
  110. `model_plot_config`.`terms`:::
  111. experimental[] (string)
  112. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-terms]
  113. `model_snapshot_retention_days`::
  114. (long)
  115. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
  116. `renormalization_window_days`::
  117. (long)
  118. include::{docdir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  119. +
  120. --
  121. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  122. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  123. --
  124. `results_retention_days`::
  125. (long)
  126. include::{docdir}/ml/ml-shared.asciidoc[tag=results-retention-days]
  127. [[ml-update-job-example]]
  128. ==== {api-examples-title}
  129. [source,console]
  130. --------------------------------------------------
  131. POST _ml/anomaly_detectors/low_request_rate/_update
  132. {
  133. "description":"An updated job",
  134. "detectors": {
  135. "detector_index": 0,
  136. "description": "An updated detector description"
  137. },
  138. "groups": ["kibana_sample_data","kibana_sample_web_logs"],
  139. "model_plot_config": {
  140. "enabled": true
  141. },
  142. "renormalization_window_days": 30,
  143. "background_persist_interval": "2h",
  144. "model_snapshot_retention_days": 7,
  145. "results_retention_days": 60
  146. }
  147. --------------------------------------------------
  148. // TEST[skip:setup:Kibana sample data]
  149. When the {anomaly-job} is updated, you receive a summary of the job
  150. configuration information, including the updated property values. For example:
  151. [source,js]
  152. ----
  153. {
  154. "job_id" : "low_request_rate",
  155. "job_type" : "anomaly_detector",
  156. "job_version" : "8.0.0",
  157. "groups" : [
  158. "kibana_sample_data",
  159. "kibana_sample_web_logs"
  160. ],
  161. "description" : "An updated job",
  162. "create_time" : 1576623023709,
  163. "analysis_config" : {
  164. "bucket_span" : "1h",
  165. "summary_count_field_name" : "doc_count",
  166. "detectors" : [
  167. {
  168. "detector_description" : "An updated detector description",
  169. "function" : "low_count",
  170. "detector_index" : 0
  171. }
  172. ],
  173. "influencers" : [ ]
  174. },
  175. ...
  176. }
  177. ----