2017-06-19 21:23:58 -04:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-04-04 18:26:39 -04:00
|
|
|
[[ml-put-job]]
|
2019-07-08 14:43:18 -04:00
|
|
|
=== Create {anomaly-jobs} API
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2019-07-25 11:58:16 -04:00
|
|
|
<titleabbrev>Create jobs</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-08 14:43:18 -04:00
|
|
|
Instantiates an {anomaly-job}.
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-put-job-request]]
|
|
|
|
==== {api-request-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`PUT _ml/anomaly_detectors/<job_id>`
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-put-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
|
2019-10-07 18:23:19 -04:00
|
|
|
<<security-privileges>>.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-put-job-desc]]
|
|
|
|
==== {api-description-title}
|
2019-02-08 06:35:37 -05:00
|
|
|
|
2019-07-08 14:43:18 -04:00
|
|
|
IMPORTANT: You must use {kib} or this API to create an {anomaly-job}. Do not put
|
|
|
|
a job directly to the `.ml-config` index using the {es} index API. If {es}
|
|
|
|
{security-features} are enabled, do not give users `write` privileges on the
|
|
|
|
`.ml-config` index.
|
2019-02-08 06:35:37 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-put-job-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<job_id>`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Required, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-define]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-put-job-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-12-27 16:30:26 -05:00
|
|
|
`allow_lazy_open`::
|
|
|
|
(Optional, boolean)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-lazy-open]
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-12-27 16:30:26 -05:00
|
|
|
[[put-analysisconfig]]`analysis_config`::
|
|
|
|
(Required, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=analysis-config]
|
|
|
|
|
|
|
|
`analysis_config`.`bucket_span`:::
|
|
|
|
(<<time-units,time units>>)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=bucket-span]
|
|
|
|
|
|
|
|
`analysis_config`.`categorization_field_name`:::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=categorization-field-name]
|
|
|
|
|
|
|
|
`analysis_config`.`categorization_filters`:::
|
|
|
|
(array of strings)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=categorization-filters]
|
|
|
|
|
|
|
|
`analysis_config`.`categorization_analyzer`:::
|
|
|
|
(object or string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=categorization-analyzer]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`:::
|
|
|
|
(array) An array of detector configuration objects. Detector configuration
|
|
|
|
objects specify which data fields a job analyzes. They also specify which
|
|
|
|
analytical functions are used. You can specify multiple detectors for a job.
|
|
|
|
+
|
|
|
|
--
|
|
|
|
NOTE: If the `detectors` array does not contain at least one detector,
|
|
|
|
no analysis can occur and an error is returned.
|
|
|
|
|
|
|
|
A detector has the following properties:
|
|
|
|
--
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`by_field_name`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=by-field-name]
|
|
|
|
|
2020-02-24 13:03:45 -05:00
|
|
|
[[put-customrules]]`analysis_config`.`detectors`.`custom_rules`::::
|
2019-12-27 16:30:26 -05:00
|
|
|
+
|
|
|
|
--
|
|
|
|
(array)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`actions`:::
|
|
|
|
(array)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-actions]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`scope`:::
|
|
|
|
(object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`scope`.`filter_id`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-id]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`scope`.`filter_type`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-scope-filter-type]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`conditions`:::
|
|
|
|
(array)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`conditions`.`applies_to`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-applies-to]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`conditions`.`operator`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-operator ]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`custom_rules`.`conditions`.`value`::::
|
|
|
|
(double)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-rules-conditions-value]
|
|
|
|
--
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`detector_description`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=detector-description]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`detector_index`::::
|
2020-01-09 11:34:34 -05:00
|
|
|
+
|
|
|
|
--
|
2019-12-27 16:30:26 -05:00
|
|
|
(integer)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=detector-index]
|
2020-01-09 11:34:34 -05:00
|
|
|
If you specify a value for this property, it is ignored.
|
|
|
|
--
|
2019-12-27 16:30:26 -05:00
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`exclude_frequent`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=exclude-frequent]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`field_name`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=detector-field-name]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`function`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=function]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`over_field_name`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=over-field-name]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`partition_field_name`::::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=partition-field-name]
|
|
|
|
|
|
|
|
`analysis_config`.`detectors`.`use_null`::::
|
|
|
|
(boolean)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=use-null]
|
|
|
|
|
|
|
|
`analysis_config`.`influencers`:::
|
|
|
|
(array of strings)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=influencers]
|
|
|
|
|
|
|
|
`analysis_config`.`latency`:::
|
|
|
|
(<<time-units,time units>>)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=latency]
|
|
|
|
|
|
|
|
`analysis_config`.`multivariate_by_fields`:::
|
|
|
|
(boolean)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=multivariate-by-fields]
|
|
|
|
|
|
|
|
`analysis_config`.`summary_count_field_name`:::
|
|
|
|
(string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=summary-count-field-name]
|
|
|
|
|
|
|
|
[[put-analysislimits]]`analysis_limits`::
|
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=analysis-limits]
|
|
|
|
+
|
|
|
|
--
|
|
|
|
The `analysis_limits` object has the following properties:
|
|
|
|
--
|
|
|
|
|
|
|
|
`analysis_limits`.`categorization_examples_limit`:::
|
|
|
|
(long)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=categorization-examples-limit]
|
|
|
|
|
|
|
|
`analysis_limits`.`model_memory_limit`:::
|
|
|
|
(long or string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=model-memory-limit]
|
2017-04-11 21:52:47 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`background_persist_interval`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, <<time-units, time units>>)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=background-persist-interval]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
2019-12-27 16:30:26 -05:00
|
|
|
[[put-customsettings]]`custom_settings`::
|
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=custom-settings]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
2019-12-27 16:30:26 -05:00
|
|
|
[[put-datadescription]]`data_description`::
|
|
|
|
(Required, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=data-description]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`description`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, string) A description of the job.
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`groups`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, array of strings)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=groups]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`model_plot_config`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, object)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config]
|
|
|
|
|
|
|
|
`model_plot_config`.`enabled`:::
|
|
|
|
(boolean)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-enabled]
|
|
|
|
|
|
|
|
`model_plot_config`.`terms`:::
|
|
|
|
experimental[] (string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=model-plot-config-terms]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`model_snapshot_retention_days`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, long)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-retention-days]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`renormalization_window_days`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, long)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=renormalization-window-days]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`results_index_name`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=results-index-name]
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`results_retention_days`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Optional, long)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=results-retention-days]
|
2017-04-25 17:08:29 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-put-job-example]]
|
|
|
|
==== {api-examples-title}
|
2017-04-04 18:26:39 -04:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2017-04-04 18:26:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
PUT _ml/anomaly_detectors/total-requests
|
2017-04-04 18:26:39 -04:00
|
|
|
{
|
2018-02-09 12:16:24 -05:00
|
|
|
"description" : "Total sum of requests",
|
|
|
|
"analysis_config" : {
|
|
|
|
"bucket_span":"10m",
|
|
|
|
"detectors": [
|
|
|
|
{
|
|
|
|
"detector_description": "Sum of total",
|
|
|
|
"function": "sum",
|
|
|
|
"field_name": "total"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"data_description" : {
|
|
|
|
"time_field":"timestamp",
|
|
|
|
"time_format": "epoch_ms"
|
|
|
|
}
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
When the job is created, you receive the following results:
|
2019-09-06 16:09:09 -04:00
|
|
|
|
|
|
|
[source,console-result]
|
2017-04-04 18:26:39 -04:00
|
|
|
----
|
|
|
|
{
|
2019-07-08 14:43:18 -04:00
|
|
|
"job_id" : "total-requests",
|
|
|
|
"job_type" : "anomaly_detector",
|
2019-12-27 16:30:26 -05:00
|
|
|
"job_version" : "7.5.0",
|
2019-07-08 14:43:18 -04:00
|
|
|
"description" : "Total sum of requests",
|
|
|
|
"create_time" : 1562352500629,
|
|
|
|
"analysis_config" : {
|
|
|
|
"bucket_span" : "10m",
|
|
|
|
"detectors" : [
|
2017-04-04 18:26:39 -04:00
|
|
|
{
|
2019-07-08 14:43:18 -04:00
|
|
|
"detector_description" : "Sum of total",
|
|
|
|
"function" : "sum",
|
|
|
|
"field_name" : "total",
|
|
|
|
"detector_index" : 0
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
],
|
2019-07-08 14:43:18 -04:00
|
|
|
"influencers" : [ ]
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
2019-07-08 14:43:18 -04:00
|
|
|
"analysis_limits" : {
|
|
|
|
"model_memory_limit" : "1024mb",
|
|
|
|
"categorization_examples_limit" : 4
|
2017-08-18 14:29:08 -04:00
|
|
|
},
|
2019-07-08 14:43:18 -04:00
|
|
|
"data_description" : {
|
|
|
|
"time_field" : "timestamp",
|
|
|
|
"time_format" : "epoch_ms"
|
2017-04-04 18:26:39 -04:00
|
|
|
},
|
2019-07-08 14:43:18 -04:00
|
|
|
"model_snapshot_retention_days" : 1,
|
2019-10-15 01:55:11 -04:00
|
|
|
"results_index_name" : "shared",
|
|
|
|
"allow_lazy_open" : false
|
2017-04-04 18:26:39 -04:00
|
|
|
}
|
|
|
|
----
|
2019-12-27 16:30:26 -05:00
|
|
|
// TESTRESPONSE[s/"job_version" : "7.5.0"/"job_version" : $body.job_version/]
|
2019-07-08 14:43:18 -04:00
|
|
|
// TESTRESPONSE[s/1562352500629/$body.$_path/]
|