update-job.asciidoc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. `detectors`::
  34. `custom_rules`:::
  35. (array)
  36. include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules]
  37. `description`:::
  38. (string)
  39. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-description]
  40. `detector_index`:::
  41. (integer)
  42. include::{docdir}/ml/ml-shared.asciidoc[tag=detector-index]
  43. [[update-analysislimits]]`analysis_limits`::
  44. `model_memory_limit`:::
  45. (long or string)
  46. include::{docdir}/ml/ml-shared.asciidoc[tag=model-memory-limit]
  47. +
  48. --
  49. NOTE: You can update the `analysis_limits` only while the job is closed. The
  50. `model_memory_limit` property value cannot be decreased below the current usage.
  51. TIP: If the `memory_status` property in the
  52. <<ml-get-snapshot-results,`model_size_stats` object>> has a value of `hard_limit`,
  53. this means that it was unable to process some data. You might want to re-run the
  54. job with an increased `model_memory_limit`.
  55. --
  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. `groups`::
  70. (array of strings)
  71. include::{docdir}/ml/ml-shared.asciidoc[tag=groups]
  72. `model_plot_config`::
  73. (object)
  74. include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config]
  75. `model_snapshot_retention_days`::
  76. (long)
  77. include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
  78. `renormalization_window_days`::
  79. (long)
  80. include::{docdir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
  81. +
  82. --
  83. NOTE: If the job is open when you make the update, you must stop the {dfeed},
  84. close the job, then reopen the job and restart the {dfeed} for the changes to take effect.
  85. --
  86. `results_retention_days`::
  87. (long)
  88. include::{docdir}/ml/ml-shared.asciidoc[tag=results-retention-days]
  89. [[ml-update-job-example]]
  90. ==== {api-examples-title}
  91. The following example updates the `total-requests` job:
  92. [source,console]
  93. --------------------------------------------------
  94. POST _ml/anomaly_detectors/total-requests/_update
  95. {
  96. "description":"An updated job",
  97. "groups": ["group1","group2"],
  98. "model_plot_config": {
  99. "enabled": true
  100. },
  101. "analysis_limits": {
  102. "model_memory_limit": "1024mb"
  103. },
  104. "renormalization_window_days": 30,
  105. "background_persist_interval": "2h",
  106. "model_snapshot_retention_days": 7,
  107. "results_retention_days": 60,
  108. "custom_settings": {
  109. "custom_urls" : [{
  110. "url_name" : "Lookup IP",
  111. "url_value" : "http://geoiplookup.net/ip/$clientip$"
  112. }]
  113. }
  114. }
  115. --------------------------------------------------
  116. // TEST[skip:setup:server_metrics_job]
  117. When the {anomaly-job} is updated, you receive a summary of the job
  118. configuration information, including the updated property values. For example:
  119. [source,console-result]
  120. ----
  121. {
  122. "job_id": "total-requests",
  123. "job_type": "anomaly_detector",
  124. "job_version": "7.0.0-alpha1",
  125. "groups": [
  126. "group1",
  127. "group2"
  128. ],
  129. "description": "An updated job",
  130. "create_time": 1518808660505,
  131. "analysis_config": {
  132. "bucket_span": "10m",
  133. "detectors": [
  134. {
  135. "detector_description": "Sum of total",
  136. "function": "sum",
  137. "field_name": "total",
  138. "detector_index": 0
  139. }
  140. ],
  141. "influencers": []
  142. },
  143. "analysis_limits": {
  144. "model_memory_limit": "1024mb",
  145. "categorization_examples_limit": 4
  146. },
  147. "data_description": {
  148. "time_field": "timestamp",
  149. "time_format": "epoch_ms"
  150. },
  151. "model_plot_config": {
  152. "enabled": true
  153. },
  154. "renormalization_window_days": 30,
  155. "background_persist_interval": "2h",
  156. "model_snapshot_retention_days": 7,
  157. "results_retention_days": 60,
  158. "custom_settings": {
  159. "custom_urls": [
  160. {
  161. "url_name": "Lookup IP",
  162. "url_value": "http://geoiplookup.net/ip/$clientip$"
  163. }
  164. ]
  165. },
  166. "results_index_name": "shared",
  167. "allow_lazy_open": false
  168. }
  169. ----
  170. // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
  171. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]