2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-update-job]]
|
2017-12-14 13:52:49 -05:00
|
|
|
=== Update Jobs API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Update Jobs</titleabbrev>
|
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-01-15 11:44:08 -05:00
|
|
|
This API enables you to update certain properties of a job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`POST _xpack/ml/anomaly_detectors/<job_id>/_update`
|
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Path Parameters
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
`job_id` (required)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the job
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Request Body
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
The following properties can be updated after the job is created:
|
|
|
|
|
2017-05-02 18:34:30 -04:00
|
|
|
[cols="<,<,<",options="header",]
|
|
|
|
|=======================================================================
|
|
|
|
|Name |Description |Requires Restart
|
|
|
|
|
|
|
|
|`analysis_limits`: `model_memory_limit` |The approximate maximum amount of
|
2017-07-10 11:50:38 -04:00
|
|
|
memory resources required for analytical processing. See <<ml-apilimits>>. | Yes
|
2017-05-02 18:34:30 -04:00
|
|
|
|
|
|
|
|`background_persist_interval` |Advanced configuration option. The time between
|
|
|
|
each periodic persistence of the model. See <<ml-job-resource>>. | Yes
|
|
|
|
|
|
|
|
|`custom_settings` |Contains custom meta data about the job. | No
|
|
|
|
|
2017-08-17 15:52:29 -04:00
|
|
|
|`description` |A description of the job. See <<ml-job-resource>>. | No
|
|
|
|
|
|
|
|
|`groups` |A list of job groups. See <<ml-job-resource>>. | No
|
2017-05-02 18:34:30 -04:00
|
|
|
|
|
|
|
|`model_plot_config`: `enabled` |If true, enables calculation and storage of the
|
|
|
|
model bounds for each entity that is being analyzed.
|
|
|
|
See <<ml-apimodelplotconfig>>. | No
|
|
|
|
|
|
|
|
|`model_snapshot_retention_days` |The time in days that model snapshots are
|
|
|
|
retained for the job. See <<ml-job-resource>>. | Yes
|
|
|
|
|
|
|
|
|`renormalization_window_days` |Advanced configuration option. The period over
|
|
|
|
which adjustments to the score are applied, as new data is seen.
|
|
|
|
See <<ml-job-resource>>. | Yes
|
|
|
|
|
|
|
|
|`results_retention_days` |Advanced configuration option. The number of days
|
|
|
|
for which job results are retained. See <<ml-job-resource>>. | Yes
|
|
|
|
|
|
|
|
|=======================================================================
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-02 18:34:30 -04:00
|
|
|
For those properties that have `Requires Restart` set to `Yes` in this table,
|
|
|
|
if the job is open when you make the update, you must stop the data feed, close
|
|
|
|
the job, then restart the data feed and open the job for the changes to take
|
|
|
|
effect.
|
|
|
|
|
2017-06-02 05:26:01 -04:00
|
|
|
//|`analysis_config`: `detectors`: `detector_index` | A unique identifier of the
|
2017-05-02 18:34:30 -04:00
|
|
|
//detector. Matches the order of detectors returned by
|
|
|
|
//<<ml-get-job,GET job>>, starting from 0. | No
|
|
|
|
//|`analysis_config`: `detectors`: `detector_description` |A description of the
|
|
|
|
//detector. See <<ml-analysisconfig>>. | No
|
2017-04-24 13:46:17 -04:00
|
|
|
|
|
|
|
[NOTE]
|
|
|
|
--
|
|
|
|
* You can update the `analysis_limits` only while the job is closed.
|
|
|
|
* The `model_memory_limit` property value cannot be decreased.
|
|
|
|
* If the `memory_status` property in the `model_size_stats` object has a value
|
|
|
|
of `hard_limit`, this means that it was unable to process some data. You might
|
|
|
|
want to re-run this job with an increased `model_memory_limit`.
|
|
|
|
--
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Authorization
|
2017-04-25 17:08:29 -04:00
|
|
|
|
|
|
|
You must have `manage_ml`, or `manage` cluster privileges to use this API.
|
2017-06-19 21:23:58 -04:00
|
|
|
For more information, see
|
|
|
|
{xpack-ref}/security-privileges.html[Security Privileges].
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
|
2017-06-06 16:42:47 -04:00
|
|
|
==== Examples
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-02-20 14:08:37 -05:00
|
|
|
The following example updates the `total-requests` job:
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-02-20 14:08:37 -05:00
|
|
|
POST _xpack/ml/anomaly_detectors/total-requests/_update
|
2017-04-04 18:26:39 -04:00
|
|
|
{
|
2017-05-02 18:34:30 -04:00
|
|
|
"description":"An updated job",
|
2017-08-17 15:52:29 -04:00
|
|
|
"groups": ["group1","group2"],
|
2017-05-02 18:34:30 -04:00
|
|
|
"model_plot_config": {
|
|
|
|
"enabled": true
|
|
|
|
},
|
|
|
|
"analysis_limits": {
|
2017-07-06 10:40:19 -04:00
|
|
|
"model_memory_limit": "1024mb"
|
2017-05-02 18:34:30 -04:00
|
|
|
},
|
|
|
|
"renormalization_window_days": 30,
|
|
|
|
"background_persist_interval": "2h",
|
|
|
|
"model_snapshot_retention_days": 7,
|
|
|
|
"results_retention_days": 60,
|
|
|
|
"custom_settings": {
|
|
|
|
"custom_urls" : [{
|
|
|
|
"url_name" : "Lookup IP",
|
|
|
|
"url_value" : "http://geoiplookup.net/ip/$clientip$"
|
|
|
|
}]
|
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
2018-02-20 14:08:37 -05:00
|
|
|
// TEST[setup:server_metrics_job]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-05-02 18:34:30 -04:00
|
|
|
When the job is updated, you receive a summary of the job configuration
|
|
|
|
information, including the updated property values. For example:
|
|
|
|
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2018-02-20 14:08:37 -05:00
|
|
|
"job_id": "total-requests",
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_type": "anomaly_detector",
|
2017-08-17 15:52:29 -04:00
|
|
|
"job_version": "7.0.0-alpha1",
|
|
|
|
"groups": [
|
|
|
|
"group1",
|
|
|
|
"group2"
|
|
|
|
],
|
2017-05-02 18:34:30 -04:00
|
|
|
"description": "An updated job",
|
2018-02-20 14:08:37 -05:00
|
|
|
"create_time": 1518808660505,
|
2017-05-02 18:34:30 -04:00
|
|
|
"analysis_config": {
|
2018-02-20 14:08:37 -05:00
|
|
|
"bucket_span": "10m",
|
2017-05-02 18:34:30 -04:00
|
|
|
"detectors": [
|
|
|
|
{
|
2018-02-20 14:08:37 -05:00
|
|
|
"detector_description": "Sum of total",
|
|
|
|
"function": "sum",
|
|
|
|
"field_name": "total",
|
2017-12-20 09:37:27 -05:00
|
|
|
"rules": [],
|
2017-06-02 05:26:01 -04:00
|
|
|
"detector_index": 0
|
2017-05-02 18:34:30 -04:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"influencers": []
|
|
|
|
},
|
2017-04-04 18:26:39 -04:00
|
|
|
"analysis_limits": {
|
2017-07-06 10:40:19 -04:00
|
|
|
"model_memory_limit": "1024mb"
|
2017-05-02 18:34:30 -04:00
|
|
|
},
|
|
|
|
"data_description": {
|
2018-02-20 14:08:37 -05:00
|
|
|
"time_field": "timestamp",
|
2017-05-02 18:34:30 -04:00
|
|
|
"time_format": "epoch_ms"
|
|
|
|
},
|
|
|
|
"model_plot_config": {
|
|
|
|
"enabled": true
|
|
|
|
},
|
|
|
|
"renormalization_window_days": 30,
|
|
|
|
"background_persist_interval": "2h",
|
|
|
|
"model_snapshot_retention_days": 7,
|
|
|
|
"results_retention_days": 60,
|
|
|
|
"custom_settings": {
|
|
|
|
"custom_urls": [
|
|
|
|
{
|
|
|
|
"url_name": "Lookup IP",
|
|
|
|
"url_value": "http://geoiplookup.net/ip/$clientip$"
|
|
|
|
}
|
|
|
|
]
|
2017-04-11 21:52:47 -04:00
|
|
|
},
|
2017-05-02 18:34:30 -04:00
|
|
|
"results_index_name": "shared"
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
----
|
2018-02-20 14:08:37 -05:00
|
|
|
// TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/]
|
|
|
|
// TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/]
|