update-job.asciidoc 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. (integer)
  95. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-index]
  96. `groups`::
  97. (array of strings)
  98. include::{docdir}/ml/ml-shared.asciidoc[tag=groups]
  99. `model_plot_config`::
  100. (object)
  101. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config]
  102. `model_plot_config`.`enabled`:::
  103. (boolean)
  104. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-enabled]
  105. `model_plot_config`.`terms`:::
  106. experimental[] (string)
  107. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-terms]
  108. `model_snapshot_retention_days`::
  109. (long)
  110. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
  111. `renormalization_window_days`::
  112. (long)
  113. include::{docdir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  114. +
  115. --
  116. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  117. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  118. --
  119. `results_retention_days`::
  120. (long)
  121. include::{docdir}/ml/ml-shared.asciidoc[tag=results-retention-days]
  122. [[ml-update-job-example]]
  123. ==== {api-examples-title}
  124. [source,console]
  125. --------------------------------------------------
  126. POST _ml/anomaly_detectors/total-requests/_update
  127. {
  128. "description":"An updated job",
  129. "groups": ["group1","group2"],
  130. "model_plot_config": {
  131. "enabled": true
  132. },
  133. "analysis_limits": {
  134. "model_memory_limit": "1024mb"
  135. },
  136. "renormalization_window_days": 30,
  137. "background_persist_interval": "2h",
  138. "model_snapshot_retention_days": 7,
  139. "results_retention_days": 60,
  140. "custom_settings": {
  141. "custom_urls" : [{
  142. "url_name" : "Lookup IP",
  143. "url_value" : "http://geoiplookup.net/ip/$clientip$"
  144. }]
  145. }
  146. }
  147. --------------------------------------------------
  148. // TEST[skip:setup:server_metrics_job]
  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,console-result]
  152. ----
  153. {
  154. "job_id": "total-requests",
  155. "job_type": "anomaly_detector",
  156. "job_version": "7.0.0-alpha1",
  157. "groups": [
  158. "group1",
  159. "group2"
  160. ],
  161. "description": "An updated job",
  162. "create_time": 1518808660505,
  163. "analysis_config": {
  164. "bucket_span": "10m",
  165. "detectors": [
  166. {
  167. "detector_description": "Sum of total",
  168. "function": "sum",
  169. "field_name": "total",
  170. "detector_index": 0
  171. }
  172. ],
  173. "influencers": []
  174. },
  175. "analysis_limits": {
  176. "model_memory_limit": "1024mb",
  177. "categorization_examples_limit": 4
  178. },
  179. "data_description": {
  180. "time_field": "timestamp",
  181. "time_format": "epoch_ms"
  182. },
  183. "model_plot_config": {
  184. "enabled": true
  185. },
  186. "renormalization_window_days": 30,
  187. "background_persist_interval": "2h",
  188. "model_snapshot_retention_days": 7,
  189. "results_retention_days": 60,
  190. "custom_settings": {
  191. "custom_urls": [
  192. {
  193. "url_name": "Lookup IP",
  194. "url_value": "http://geoiplookup.net/ip/$clientip$"
  195. }
  196. ]
  197. },
  198. "results_index_name": "shared",
  199. "allow_lazy_open": false
  200. }
  201. ----
  202. // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
  203. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]