| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 | [role="xpack"][testenv="platinum"][[ml-update-job]]= Update {anomaly-jobs} API++++<titleabbrev>Update jobs</titleabbrev>++++Updates certain properties of an {anomaly-job}.[[ml-update-job-request]]== {api-request-title}`POST _ml/anomaly_detectors/<job_id>/_update`[[ml-update-job-prereqs]]== {api-prereq-title}* If the {es} {security-features} are enabled, you must have `manage_ml` or`manage` cluster privileges to use this API. See<<security-privileges>> and {ml-docs-setup-privileges}.[[ml-update-job-path-parms]]== {api-path-parms-title}`<job_id>`::(Required, string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection][role="child_attributes"][[ml-update-job-request-body]]== {api-request-body-title}The following properties can be updated after the job is created:`allow_lazy_open`::(boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-lazy-open]+--NOTE: If the job is open when you make the update, you must stop the {dfeed},close the job, then reopen the job and restart the {dfeed} for the changes to take effect.--//Begin analysis_limits[[update-analysislimits]]`analysis_limits`::(Optional, object)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=analysis-limits]+.Properties of `analysis_limits`[%collapsible%open]====`model_memory_limit`:::(long or string) include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-memory-limit]+--NOTE: You can update the `analysis_limits` only while the job is closed. The `model_memory_limit` property value cannot be decreased below the current usage. TIP: If the `memory_status` property in the<<ml-get-snapshot-results,`model_size_stats` object>> has a value of `hard_limit`,mthis means that it was unable to process some data. You might want to re-run the job with an increased `model_memory_limit`.--====//End analysis_limits`background_persist_interval`::(<<time-units,time units>>)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=background-persist-interval]+--NOTE: If the job is open when you make the update, you must stop the {dfeed},close the job, then reopen the job and restart the {dfeed} for the changes to take effect.--[[update-customsettings]]`custom_settings`::(object)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-settings]`daily_model_snapshot_retention_after_days`::(long)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=daily-model-snapshot-retention-after-days]`description`::(string) A description of the job.//Begin detectors`detectors`::(array) An array of detector update objects.+.Properties of `detectors`[%collapsible%open]====//Begin detectors.custom_rules`custom_rules`:::(array)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules]+.Properties of `custom_rules`[%collapsible%open]=====`actions`:::(array)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-actions]// Begin detectors.custom_rules.conditions`conditions`:::(array)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions]+.Properties of `conditions`[%collapsible%open]======`applies_to`::::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-applies-to]`operator`::::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-operator]`value`::::(double)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-value]======//End detectors.custom_rules.conditions//Begin detectors.custom_rules.scope`scope`:::(object)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-scope]+.Properties of `scope`[%collapsible%open]======`filter_id`::::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-id]`filter_type`::::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-type]======//End detectors.custom_rules.scope=====//End detectors.custom_rules`description`:::(string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=detector-description]`detector_index`:::(integer)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=detector-index]+--If you want to update a specific detector, you must use this identifier. Youcannot, however, change the `detector_index` value for a detector.--====//End detectors`groups`::(array of strings)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=groups]//Begin model_plot_config`model_plot_config`::(object)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config]+.Properties of `model_plot_config`[%collapsible%open]====`annotations_enabled`:::(boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config-annotations-enabled]`enabled`:::(boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config-enabled]`terms`:::experimental[] (string)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-plot-config-terms]====//End model_plot_config`model_snapshot_retention_days`::(long)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]//Begin per_partition_categorization`per_partition_categorization`:::(object)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=per-partition-categorization]+.Properties of `per_partition_categorization`[%collapsible%open]====`enabled`:::(boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=per-partition-categorization-enabled]`stop_on_warn`:::(boolean)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=per-partition-categorization-stop-on-warn]====//End per_partition_categorization`renormalization_window_days`::(long)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]+--NOTE: If the job is open when you make the update, you must stop the {dfeed},close the job, then reopen the job and restart the {dfeed} for the changes to take effect.--`results_retention_days`::(long)include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=results-retention-days][[ml-update-job-example]]== {api-examples-title}[source,console]--------------------------------------------------POST _ml/anomaly_detectors/low_request_rate/_update{  "description":"An updated job",  "detectors": {    "detector_index": 0,    "description": "An updated detector description"  },  "groups": ["kibana_sample_data","kibana_sample_web_logs"],  "model_plot_config": {    "enabled": true  },  "renormalization_window_days": 30,  "background_persist_interval": "2h",  "model_snapshot_retention_days": 7,  "results_retention_days": 60}--------------------------------------------------// TEST[skip:setup:Kibana sample data]When the {anomaly-job} is updated, you receive a summary of the jobconfiguration information, including the updated property values. For example:[source,js]----{  "job_id" : "low_request_rate",  "job_type" : "anomaly_detector",  "job_version" : "8.0.0",  "groups" : [    "kibana_sample_data",    "kibana_sample_web_logs"  ],  "description" : "An updated job",  "create_time" : 1576623023709,  "analysis_config" : {    "bucket_span" : "1h",    "summary_count_field_name" : "doc_count",    "detectors" : [      {        "detector_description" : "An updated detector description",        "function" : "low_count",        "detector_index" : 0      }    ],    "influencers" : [ ]  },  ...}----
 |