2017-04-11 21:52:47 -04:00
|
|
|
//lcawley Verified example output 2017-04-11
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-put-job]]
|
|
|
|
==== Create Jobs
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
The create job API enables you to instantiate a job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
===== Request
|
|
|
|
|
|
|
|
`PUT _xpack/ml/anomaly_detectors/<job_id>`
|
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Description
|
|
|
|
|
2017-04-18 18:13:21 -04:00
|
|
|
You must have `manage_ml`, or `manage` cluster privileges to use this API.
|
|
|
|
For more information, see <<privileges-list-cluster>>.
|
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Path Parameters
|
|
|
|
|
|
|
|
`job_id` (required)::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) Identifier for the job
|
2017-04-04 18:26:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
===== Request Body
|
|
|
|
|
|
|
|
`analysis_config`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(object) The analysis configuration, which specifies how to analyze the data.
|
2017-04-04 18:26:39 -04:00
|
|
|
See <<ml-analysisconfig, analysis configuration objects>>.
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`analysis_limits`::
|
|
|
|
Optionally specifies runtime limits for the job. See <<ml-apilimits,analysis limits>>.
|
|
|
|
|
2017-04-04 18:26:39 -04:00
|
|
|
`data_description`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(object) Describes the format of the input data.
|
2017-04-04 18:26:39 -04:00
|
|
|
See <<ml-datadescription,data description objects>>.
|
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`description`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(string) An optional description of the job.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
`model_snapshot_retention_days`::
|
2017-04-11 22:26:18 -04:00
|
|
|
(long) The time in days that model snapshots are retained for the job.
|
2017-04-11 21:52:47 -04:00
|
|
|
Older snapshots are deleted. The default value is 1 day.
|
|
|
|
|
|
|
|
`results_index_name`::
|
2017-04-20 01:54:24 -04:00
|
|
|
(string) The name of the index in which to store the {ml} results.
|
|
|
|
The default value is `shared`, which corresponds to the index name
|
|
|
|
`.ml-anomalies-shared`.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2017-04-11 21:52:47 -04:00
|
|
|
////
|
2017-04-04 18:26:39 -04:00
|
|
|
===== Responses
|
|
|
|
|
|
|
|
TBD
|
|
|
|
////
|
|
|
|
////
|
|
|
|
200
|
|
|
|
(EmptyResponse) The cluster has been successfully deleted
|
|
|
|
404
|
|
|
|
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
|
|
|
|
412
|
|
|
|
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
|
|
|
|
////
|
|
|
|
|
|
|
|
===== Examples
|
|
|
|
|
|
|
|
The following example creates the `it-ops-kpi` job:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
PUT _xpack/ml/anomaly_detectors/it-ops-kpi
|
|
|
|
{
|
|
|
|
"description":"First simple job",
|
|
|
|
"analysis_config":{
|
|
|
|
"bucket_span": "5m",
|
|
|
|
"latency": "0ms",
|
|
|
|
"detectors":[
|
|
|
|
{
|
|
|
|
"detector_description": "low_sum(events_per_min)",
|
|
|
|
"function":"low_sum",
|
|
|
|
"field_name": "events_per_min"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"data_description": {
|
|
|
|
"time_field":"@timestamp",
|
|
|
|
"time_format":"epoch_ms"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
// TEST[skip:todo]
|
|
|
|
|
|
|
|
When the job is created, you receive the following results:
|
2017-04-21 11:23:27 -04:00
|
|
|
[source,js]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"job_id": "it-ops-kpi",
|
2017-04-11 21:52:47 -04:00
|
|
|
"job_type": "anomaly_detector",
|
2017-04-04 18:26:39 -04:00
|
|
|
"description": "First simple job",
|
2017-04-11 21:52:47 -04:00
|
|
|
"create_time": 1491948238874,
|
2017-04-04 18:26:39 -04:00
|
|
|
"analysis_config": {
|
|
|
|
"bucket_span": "5m",
|
|
|
|
"latency": "0ms",
|
|
|
|
"detectors": [
|
|
|
|
{
|
|
|
|
"detector_description": "low_sum(events_per_min)",
|
|
|
|
"function": "low_sum",
|
|
|
|
"field_name": "events_per_min",
|
|
|
|
"detector_rules": []
|
|
|
|
}
|
|
|
|
],
|
2017-04-11 21:52:47 -04:00
|
|
|
"influencers": []
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
|
|
|
"data_description": {
|
|
|
|
"time_field": "@timestamp",
|
|
|
|
"time_format": "epoch_ms"
|
|
|
|
},
|
|
|
|
"model_snapshot_retention_days": 1,
|
|
|
|
"results_index_name": "shared"
|
|
|
|
}
|
|
|
|
----
|