update-job.asciidoc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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) Identifier for the {anomaly-job}.
  21. [[ml-update-job-request-body]]
  22. ==== {api-request-body-title}
  23. The following properties can be updated after the job is created:
  24. [cols="<,<,<",options="header",]
  25. |=======================================================================
  26. |Name |Description |Requires Restart
  27. |`analysis_limits.model_memory_limit` |The approximate maximum amount of
  28. memory resources required for analytical processing. See <<ml-apilimits>>. You
  29. can update the `analysis_limits` only while the job is closed. The
  30. `model_memory_limit` property value cannot be decreased below the current usage.
  31. | Yes
  32. |`background_persist_interval` |Advanced configuration option. The time between
  33. each periodic persistence of the model. See <<ml-job-resource>>. | Yes
  34. |`custom_settings` |Contains custom meta data about the job. | No
  35. |`description` |A description of the job. See <<ml-job-resource>>. | No
  36. |`detectors` |An array of detector update objects. | No
  37. |`detector_index` |The identifier of the detector to update (integer).| No
  38. |`detectors.description` |The new description for the detector.| No
  39. |`detectors.custom_rules` |The new list of <<ml-detector-custom-rule, rules>>
  40. for the detector. | No
  41. |`groups` |A list of job groups. See <<ml-job-resource>>. | No
  42. |`model_plot_config.enabled` |If true, enables calculation and storage of the
  43. model bounds for each entity that is being analyzed.
  44. See <<ml-apimodelplotconfig>>. | No
  45. |`model_snapshot_retention_days` |The time in days that model snapshots are
  46. retained for the job. See <<ml-job-resource>>. | No
  47. |`renormalization_window_days` |Advanced configuration option. The period over
  48. which adjustments to the score are applied, as new data is seen.
  49. See <<ml-job-resource>>. | Yes
  50. |`results_retention_days` |Advanced configuration option. The number of days
  51. for which job results are retained. See <<ml-job-resource>>. | No
  52. |`allow_lazy_open` |Advanced configuration option. Whether to allow the job to be
  53. opened when no {ml} node has sufficient capacity. See <<ml-job-resource>>. | Yes
  54. |=======================================================================
  55. For those properties that have `Requires Restart` set to `Yes` in this table,
  56. if the job is open when you make the update, you must stop the data feed, close
  57. the job, then reopen the job and restart the data feed for the changes to take
  58. effect.
  59. [NOTE]
  60. --
  61. * If the `memory_status` property in the `model_size_stats` object has a value
  62. of `hard_limit`, this means that it was unable to process some data. You might
  63. want to re-run this job with an increased `model_memory_limit`.
  64. --
  65. [[ml-update-job-example]]
  66. ==== {api-examples-title}
  67. The following example updates the `total-requests` job:
  68. [source,console]
  69. --------------------------------------------------
  70. POST _ml/anomaly_detectors/total-requests/_update
  71. {
  72. "description":"An updated job",
  73. "groups": ["group1","group2"],
  74. "model_plot_config": {
  75. "enabled": true
  76. },
  77. "analysis_limits": {
  78. "model_memory_limit": "1024mb"
  79. },
  80. "renormalization_window_days": 30,
  81. "background_persist_interval": "2h",
  82. "model_snapshot_retention_days": 7,
  83. "results_retention_days": 60,
  84. "custom_settings": {
  85. "custom_urls" : [{
  86. "url_name" : "Lookup IP",
  87. "url_value" : "http://geoiplookup.net/ip/$clientip$"
  88. }]
  89. }
  90. }
  91. --------------------------------------------------
  92. // TEST[skip:setup:server_metrics_job]
  93. When the {anomaly-job} is updated, you receive a summary of the job
  94. configuration information, including the updated property values. For example:
  95. [source,console-result]
  96. ----
  97. {
  98. "job_id": "total-requests",
  99. "job_type": "anomaly_detector",
  100. "job_version": "7.0.0-alpha1",
  101. "groups": [
  102. "group1",
  103. "group2"
  104. ],
  105. "description": "An updated job",
  106. "create_time": 1518808660505,
  107. "analysis_config": {
  108. "bucket_span": "10m",
  109. "detectors": [
  110. {
  111. "detector_description": "Sum of total",
  112. "function": "sum",
  113. "field_name": "total",
  114. "detector_index": 0
  115. }
  116. ],
  117. "influencers": []
  118. },
  119. "analysis_limits": {
  120. "model_memory_limit": "1024mb",
  121. "categorization_examples_limit": 4
  122. },
  123. "data_description": {
  124. "time_field": "timestamp",
  125. "time_format": "epoch_ms"
  126. },
  127. "model_plot_config": {
  128. "enabled": true
  129. },
  130. "renormalization_window_days": 30,
  131. "background_persist_interval": "2h",
  132. "model_snapshot_retention_days": 7,
  133. "results_retention_days": 60,
  134. "custom_settings": {
  135. "custom_urls": [
  136. {
  137. "url_name": "Lookup IP",
  138. "url_value": "http://geoiplookup.net/ip/$clientip$"
  139. }
  140. ]
  141. },
  142. "results_index_name": "shared",
  143. "allow_lazy_open": false
  144. }
  145. ----
  146. // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
  147. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]