update-job.asciidoc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-update-job]]
  4. === Update jobs API
  5. ++++
  6. <titleabbrev>Update jobs</titleabbrev>
  7. ++++
  8. Updates certain properties of a job.
  9. [[ml-update-job-request]]
  10. ==== {api-request-title}
  11. `POST _ml/anomaly_detectors/<job_id>/_update`
  12. [[ml-update-job-path-parms]]
  13. ==== {api-path-parms-title}
  14. `job_id` (required)::
  15. (string) Identifier for the job
  16. [[ml-update-job-request-body]]
  17. ==== {api-request-body-title}
  18. The following properties can be updated after the job is created:
  19. [cols="<,<,<",options="header",]
  20. |=======================================================================
  21. |Name |Description |Requires Restart
  22. |`analysis_limits`: `model_memory_limit` |The approximate maximum amount of
  23. memory resources required for analytical processing. See <<ml-apilimits>>. | Yes
  24. |`background_persist_interval` |Advanced configuration option. The time between
  25. each periodic persistence of the model. See <<ml-job-resource>>. | Yes
  26. |`custom_settings` |Contains custom meta data about the job. | No
  27. |`description` |A description of the job. See <<ml-job-resource>>. | No
  28. |`detectors` |An array of <<ml-detector-update, detector update objects>>. | No
  29. |`groups` |A list of job groups. See <<ml-job-resource>>. | No
  30. |`model_plot_config`: `enabled` |If true, enables calculation and storage of the
  31. model bounds for each entity that is being analyzed.
  32. See <<ml-apimodelplotconfig>>. | No
  33. |`model_snapshot_retention_days` |The time in days that model snapshots are
  34. retained for the job. See <<ml-job-resource>>. | Yes
  35. |`renormalization_window_days` |Advanced configuration option. The period over
  36. which adjustments to the score are applied, as new data is seen.
  37. See <<ml-job-resource>>. | Yes
  38. |`results_retention_days` |Advanced configuration option. The number of days
  39. for which job results are retained. See <<ml-job-resource>>. | Yes
  40. |=======================================================================
  41. For those properties that have `Requires Restart` set to `Yes` in this table,
  42. if the job is open when you make the update, you must stop the data feed, close
  43. the job, then restart the data feed and open the job for the changes to take
  44. effect.
  45. [NOTE]
  46. --
  47. * You can update the `analysis_limits` only while the job is closed.
  48. * The `model_memory_limit` property value cannot be decreased below the current usage.
  49. * If the `memory_status` property in the `model_size_stats` object has a value
  50. of `hard_limit`, this means that it was unable to process some data. You might
  51. want to re-run this job with an increased `model_memory_limit`.
  52. --
  53. [[ml-detector-update]]
  54. ==== Detector Update Objects
  55. A detector update object has the following properties:
  56. `detector_index`::
  57. (integer) The identifier of the detector to update.
  58. `description`::
  59. (string) The new description for the detector.
  60. `custom_rules`::
  61. (array) The new list of <<ml-detector-custom-rule, rules>> for the detector.
  62. No other detector property can be updated.
  63. [[ml-update-job-prereqs]]
  64. ==== {api-prereq-title}
  65. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  66. For more information, see
  67. {stack-ov}/security-privileges.html[Security privileges].
  68. [[ml-update-job-example]]
  69. ==== {api-examples-title}
  70. The following example updates the `total-requests` job:
  71. [source,js]
  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. // CONSOLE
  96. // TEST[skip:setup:server_metrics_job]
  97. When the job is updated, you receive a summary of the job configuration
  98. information, including the updated property values. For example:
  99. [source,js]
  100. ----
  101. {
  102. "job_id": "total-requests",
  103. "job_type": "anomaly_detector",
  104. "job_version": "7.0.0-alpha1",
  105. "groups": [
  106. "group1",
  107. "group2"
  108. ],
  109. "description": "An updated job",
  110. "create_time": 1518808660505,
  111. "analysis_config": {
  112. "bucket_span": "10m",
  113. "detectors": [
  114. {
  115. "detector_description": "Sum of total",
  116. "function": "sum",
  117. "field_name": "total",
  118. "detector_index": 0
  119. }
  120. ],
  121. "influencers": []
  122. },
  123. "analysis_limits": {
  124. "model_memory_limit": "1024mb",
  125. "categorization_examples_limit": 4
  126. },
  127. "data_description": {
  128. "time_field": "timestamp",
  129. "time_format": "epoch_ms"
  130. },
  131. "model_plot_config": {
  132. "enabled": true
  133. },
  134. "renormalization_window_days": 30,
  135. "background_persist_interval": "2h",
  136. "model_snapshot_retention_days": 7,
  137. "results_retention_days": 60,
  138. "custom_settings": {
  139. "custom_urls": [
  140. {
  141. "url_name": "Lookup IP",
  142. "url_value": "http://geoiplookup.net/ip/$clientip$"
  143. }
  144. ]
  145. },
  146. "results_index_name": "shared"
  147. }
  148. ----
  149. // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
  150. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]