update-job.asciidoc 5.3 KB

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