Create an anomaly detection job Added in 5.4.0
If you include a datafeed_config
, you must have read index privileges on the source index.
Path parameters
-
The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.
Body Required
-
allow_lazy_open boolean
Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide
xpack.ml.max_lazy_ml_nodes
setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. -
Additional properties are allowed.
-
analysis_limits object
Additional properties are allowed.
-
background_persist_interval string
A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
custom_settings object
Custom metadata about the job
Additional properties are allowed.
-
Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to
model_snapshot_retention_days
. -
Additional properties are allowed.
-
datafeed_config object
Additional properties are allowed.
-
description string
A description of the job.
-
groups array[string]
A list of job groups. A job can belong to no groups or many.
-
model_plot_config object
Additional properties are allowed.
-
Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job. By default, snapshots ten days older than the newest snapshot are deleted.
-
renormalization_window_days number
Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans.
-
results_index_name string
-
results_retention_days number
Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever.
curl \
-X PUT http://api.example.com/_ml/anomaly_detectors/{job_id} \
-H "Content-Type: application/json" \
-d '{"allow_lazy_open":true,"analysis_config":{"bucket_span":"string","":"string","categorization_field_name":"string","categorization_filters":["string"],"detectors":[{"by_field_name":"string","custom_rules":[{"actions":["skip_result"],"conditions":[{}],"scope":{"additionalProperty1":{},"additionalProperty2":{}}}],"detector_description":"string","detector_index":42.0,"exclude_frequent":"all","field_name":"string","function":"string","over_field_name":"string","partition_field_name":"string","use_null":true}],"influencers":["string"],"latency":"string","model_prune_window":"string","multivariate_by_fields":true,"per_partition_categorization":{"enabled":true,"stop_on_warn":true},"summary_count_field_name":"string"},"analysis_limits":{"categorization_examples_limit":42.0,"model_memory_limit":"string"},"background_persist_interval":"string","custom_settings":{},"daily_model_snapshot_retention_after_days":42.0,"data_description":{"format":"string","time_field":"string","time_format":"string","field_delimiter":"string"},"datafeed_config":{"aggregations":{},"chunking_config":{"mode":"auto","time_span":"string"},"datafeed_id":"string","delayed_data_check_config":{"check_window":"string","enabled":true},"frequency":"string","indices":"string","indices_options":{"allow_no_indices":true,"expand_wildcards":"string","ignore_unavailable":true,"ignore_throttled":true},"job_id":"string","max_empty_searches":42.0,"query":{},"query_delay":"string","runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}},"script_fields":{"additionalProperty1":{"script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"ignore_failure":true},"additionalProperty2":{"script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"ignore_failure":true}},"scroll_size":42.0},"description":"string","groups":["string"],"model_plot_config":{"annotations_enabled":true,"enabled":true,"terms":"string"},"model_snapshot_retention_days":42.0,"renormalization_window_days":42.0,"results_index_name":"string","results_retention_days":42.0}'
{
"allow_lazy_open": true,
"analysis_config": {
"bucket_span": "string",
"": "string",
"categorization_field_name": "string",
"categorization_filters": [
"string"
],
"detectors": [
{
"by_field_name": "string",
"custom_rules": [
{
"actions": [
"skip_result"
],
"conditions": [
{}
],
"scope": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
],
"detector_description": "string",
"detector_index": 42.0,
"exclude_frequent": "all",
"field_name": "string",
"function": "string",
"over_field_name": "string",
"partition_field_name": "string",
"use_null": true
}
],
"influencers": [
"string"
],
"latency": "string",
"model_prune_window": "string",
"multivariate_by_fields": true,
"per_partition_categorization": {
"enabled": true,
"stop_on_warn": true
},
"summary_count_field_name": "string"
},
"analysis_limits": {
"categorization_examples_limit": 42.0,
"model_memory_limit": "string"
},
"background_persist_interval": "string",
"custom_settings": {},
"daily_model_snapshot_retention_after_days": 42.0,
"data_description": {
"format": "string",
"time_field": "string",
"time_format": "string",
"field_delimiter": "string"
},
"datafeed_config": {
"aggregations": {},
"chunking_config": {
"mode": "auto",
"time_span": "string"
},
"datafeed_id": "string",
"delayed_data_check_config": {
"check_window": "string",
"enabled": true
},
"frequency": "string",
"indices": "string",
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"job_id": "string",
"max_empty_searches": 42.0,
"query": {},
"query_delay": "string",
"runtime_mappings": {
"additionalProperty1": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
},
"additionalProperty2": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
}
},
"script_fields": {
"additionalProperty1": {
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
},
"additionalProperty2": {
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
}
},
"scroll_size": 42.0
},
"description": "string",
"groups": [
"string"
],
"model_plot_config": {
"annotations_enabled": true,
"enabled": true,
"terms": "string"
},
"model_snapshot_retention_days": 42.0,
"renormalization_window_days": 42.0,
"results_index_name": "string",
"results_retention_days": 42.0
}
{
"allow_lazy_open": true,
"analysis_config": {
"bucket_span": "string",
"": "string",
"categorization_field_name": "string",
"categorization_filters": [
"string"
],
"detectors": [
{
"by_field_name": "string",
"custom_rules": [
{
"actions": [
"skip_result"
],
"conditions": [
{}
],
"scope": {}
}
],
"detector_description": "string",
"detector_index": 42.0,
"exclude_frequent": "all",
"field_name": "string",
"function": "string",
"over_field_name": "string",
"partition_field_name": "string",
"use_null": true
}
],
"influencers": [
"string"
],
"model_prune_window": "string",
"latency": "string",
"multivariate_by_fields": true,
"per_partition_categorization": {
"enabled": true,
"stop_on_warn": true
},
"summary_count_field_name": "string"
},
"analysis_limits": {
"categorization_examples_limit": 42.0,
"model_memory_limit": "string"
},
"background_persist_interval": "string",
"": "string",
"custom_settings": {},
"daily_model_snapshot_retention_after_days": 42.0,
"data_description": {
"format": "string",
"time_field": "string",
"time_format": "string",
"field_delimiter": "string"
},
"datafeed_config": {
"aggregations": {},
"authorization": {
"api_key": {
"id": "string",
"name": "string"
},
"roles": [
"string"
],
"service_account": "string"
},
"chunking_config": {
"mode": "auto",
"time_span": "string"
},
"datafeed_id": "string",
"frequency": "string",
"indices": [
"string"
],
"indexes": [
"string"
],
"job_id": "string",
"max_empty_searches": 42.0,
"query_delay": "string",
"script_fields": {
"additionalProperty1": {
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
},
"additionalProperty2": {
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"ignore_failure": true
}
},
"scroll_size": 42.0,
"delayed_data_check_config": {
"check_window": "string",
"enabled": true
},
"runtime_mappings": {
"additionalProperty1": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
},
"additionalProperty2": {
"fields": {
"additionalProperty1": {
"type": "boolean"
},
"additionalProperty2": {
"type": "boolean"
}
},
"fetch_fields": [
{
"field": "string",
"format": "string"
}
],
"format": "string",
"input_field": "string",
"target_field": "string",
"target_index": "string",
"script": {
"source": "string",
"id": "string",
"params": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"": "painless",
"options": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"type": "boolean"
}
},
"indices_options": {
"allow_no_indices": true,
"expand_wildcards": "string",
"ignore_unavailable": true,
"ignore_throttled": true
},
"query": {}
},
"description": "string",
"groups": [
"string"
],
"job_id": "string",
"job_type": "string",
"job_version": "string",
"model_plot_config": {
"annotations_enabled": true,
"enabled": true,
"terms": "string"
},
"model_snapshot_id": "string",
"model_snapshot_retention_days": 42.0,
"renormalization_window_days": 42.0,
"results_index_name": "string",
"results_retention_days": 42.0
}