update-job.asciidoc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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>>. | Yes
  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>>. | Yes
  52. |=======================================================================
  53. For those properties that have `Requires Restart` set to `Yes` in this table,
  54. if the job is open when you make the update, you must stop the data feed, close
  55. the job, then restart the data feed and open the job for the changes to take
  56. effect.
  57. [NOTE]
  58. --
  59. * If the `memory_status` property in the `model_size_stats` object has a value
  60. of `hard_limit`, this means that it was unable to process some data. You might
  61. want to re-run this job with an increased `model_memory_limit`.
  62. --
  63. [[ml-update-job-example]]
  64. ==== {api-examples-title}
  65. The following example updates the `total-requests` job:
  66. [source,console]
  67. --------------------------------------------------
  68. POST _ml/anomaly_detectors/total-requests/_update
  69. {
  70. "description":"An updated job",
  71. "groups": ["group1","group2"],
  72. "model_plot_config": {
  73. "enabled": true
  74. },
  75. "analysis_limits": {
  76. "model_memory_limit": "1024mb"
  77. },
  78. "renormalization_window_days": 30,
  79. "background_persist_interval": "2h",
  80. "model_snapshot_retention_days": 7,
  81. "results_retention_days": 60,
  82. "custom_settings": {
  83. "custom_urls" : [{
  84. "url_name" : "Lookup IP",
  85. "url_value" : "http://geoiplookup.net/ip/$clientip$"
  86. }]
  87. }
  88. }
  89. --------------------------------------------------
  90. // TEST[skip:setup:server_metrics_job]
  91. When the {anomaly-job} is updated, you receive a summary of the job
  92. configuration information, including the updated property values. For example:
  93. [source,console-result]
  94. ----
  95. {
  96. "job_id": "total-requests",
  97. "job_type": "anomaly_detector",
  98. "job_version": "7.0.0-alpha1",
  99. "groups": [
  100. "group1",
  101. "group2"
  102. ],
  103. "description": "An updated job",
  104. "create_time": 1518808660505,
  105. "analysis_config": {
  106. "bucket_span": "10m",
  107. "detectors": [
  108. {
  109. "detector_description": "Sum of total",
  110. "function": "sum",
  111. "field_name": "total",
  112. "detector_index": 0
  113. }
  114. ],
  115. "influencers": []
  116. },
  117. "analysis_limits": {
  118. "model_memory_limit": "1024mb",
  119. "categorization_examples_limit": 4
  120. },
  121. "data_description": {
  122. "time_field": "timestamp",
  123. "time_format": "epoch_ms"
  124. },
  125. "model_plot_config": {
  126. "enabled": true
  127. },
  128. "renormalization_window_days": 30,
  129. "background_persist_interval": "2h",
  130. "model_snapshot_retention_days": 7,
  131. "results_retention_days": 60,
  132. "custom_settings": {
  133. "custom_urls": [
  134. {
  135. "url_name": "Lookup IP",
  136. "url_value": "http://geoiplookup.net/ip/$clientip$"
  137. }
  138. ]
  139. },
  140. "results_index_name": "shared"
  141. }
  142. ----
  143. // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
  144. // TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]