update-job.asciidoc 5.1 KB

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