Skip to content

Commit 9f6d666

Browse files
authored
[DOCS] Move anomaly detection job resource definitions into APIs (#49700) (#50513)
1 parent 13a05e4 commit 9f6d666

40 files changed

+551
-866
lines changed

docs/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ buildRestTests.expectedUnconvertedCandidates = [
2929
'reference/ml/anomaly-detection/apis/get-category.asciidoc',
3030
'reference/ml/anomaly-detection/apis/get-influencer.asciidoc',
3131
'reference/ml/anomaly-detection/apis/get-job-stats.asciidoc',
32+
'reference/ml/anomaly-detection/apis/get-job.asciidoc',
3233
'reference/ml/anomaly-detection/apis/get-overall-buckets.asciidoc',
3334
'reference/ml/anomaly-detection/apis/get-record.asciidoc',
3435
'reference/ml/anomaly-detection/apis/get-snapshot.asciidoc',

docs/reference/ml/anomaly-detection/apis/close-job.asciidoc

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,33 +60,23 @@ results the job might have recently produced or might produce in the future.
6060
==== {api-path-parms-title}
6161

6262
`<job_id>`::
63-
(Required, string) Identifier for the {anomaly-job}. It can be a job
64-
identifier, a group name, or a wildcard expression.
63+
(Required, string)
64+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-wildcard]
6565

6666
[[ml-close-job-query-parms]]
6767
==== {api-query-parms-title}
6868

6969
`allow_no_jobs`::
70-
(Optional, boolean) Specifies what to do when the request:
71-
+
72-
--
73-
* Contains wildcard expressions and there are no jobs that match.
74-
* Contains the `_all` string or no identifiers and there are no matches.
75-
* Contains wildcard expressions and there are only partial matches.
76-
77-
The default value is `true`, which returns an empty `jobs` array
78-
when there are no matches and the subset of results when there are partial
79-
matches. If this parameter is `false`, the request returns a `404` status code
80-
when there are no matches or only partial matches.
81-
--
70+
(Optional, boolean)
71+
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
8272

8373
`force`::
84-
(Optional, boolean) Use to close a failed job, or to forcefully close a job
85-
which has not responded to its initial close request.
74+
(Optional, boolean) Use to close a failed job, or to forcefully close a job
75+
which has not responded to its initial close request.
8676

8777
`timeout`::
88-
(Optional, <<time-units, time units>>) Controls the time to wait until a job
89-
has closed. The default value is 30 minutes.
78+
(Optional, <<time-units, time units>>) Controls the time to wait until a job
79+
has closed. The default value is 30 minutes.
9080

9181
[[ml-close-job-response-codes]]
9282
==== {api-response-codes-title}

docs/reference/ml/anomaly-detection/apis/datafeedresource.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ A {dfeed} resource has the following properties:
5050
`script_fields`::
5151
(object) Specifies scripts that evaluate custom expressions and returns
5252
script fields to the {dfeed}.
53-
The <<ml-detectorconfig,detector configuration objects>> in a job can contain
53+
The detector configuration objects in a job can contain
5454
functions that use these script fields.
5555
For more information, see
5656
{ml-docs}/ml-configuring-transform.html[Transforming data with script fields].

docs/reference/ml/anomaly-detection/apis/delete-job.asciidoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,19 @@ separated list.
3939
==== {api-path-parms-title}
4040

4141
`<job_id>`::
42-
(Required, string) Identifier for the {anomaly-job}.
42+
(Required, string)
43+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
4344

4445
[[ml-delete-job-query-parms]]
4546
==== {api-query-parms-title}
4647

4748
`force`::
48-
(Optional, boolean) Use to forcefully delete an opened job; this method is
49-
quicker than closing and deleting the job.
49+
(Optional, boolean) Use to forcefully delete an opened job; this method is
50+
quicker than closing and deleting the job.
5051

5152
`wait_for_completion`::
52-
(Optional, boolean) Specifies whether the request should return immediately or
53-
wait until the job deletion completes. Defaults to `true`.
53+
(Optional, boolean) Specifies whether the request should return immediately or
54+
wait until the job deletion completes. Defaults to `true`.
5455

5556
[[ml-delete-job-example]]
5657
==== {api-examples-title}

docs/reference/ml/anomaly-detection/apis/flush-job.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ opened again before analyzing further data.
3737
==== {api-path-parms-title}
3838

3939
`<job_id>`::
40-
(string) Required. Identifier for the job.
40+
(Required, string)
41+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
4142

4243
[[ml-flush-job-query-parms]]
4344
==== {api-query-parms-title}

docs/reference/ml/anomaly-detection/apis/forecast.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ See {ml-docs}/ml-overview.html#ml-forecasting[Forecasting the future].
2929
===============================
3030
3131
* If you use an `over_field_name` property in your job, you cannot create a
32-
forecast. For more information about this property, see <<ml-job-resource>>.
32+
forecast. For more information about this property, see <<ml-put-job>>.
3333
* The job must be open when you create a forecast. Otherwise, an error occurs.
3434
===============================
3535

3636
[[ml-forecast-path-parms]]
3737
==== {api-path-parms-title}
3838

3939
`<job_id>`::
40-
(Required, string) Identifier for the job.
40+
(Required, string)
41+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
4142

4243
[[ml-forecast-request-body]]
4344
==== {api-request-body-title}

docs/reference/ml/anomaly-detection/apis/get-bucket.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ bucket.
3636
==== {api-path-parms-title}
3737

3838
`<job_id>`::
39-
(Required, string) Identifier for the {anomaly-job}.
39+
(Required, string)
40+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
4041

4142
`<timestamp>`::
4243
(Optional, string) The timestamp of a single bucket result. If you do not

docs/reference/ml/anomaly-detection/apis/get-category.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ For more information about categories, see
3535
==== {api-path-parms-title}
3636

3737
`<job_id>`::
38-
(Required, string) Identifier for the {anomaly-job}.
38+
(Required, string)
39+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
3940

4041
`<category_id>`::
4142
(Optional, long) Identifier for the category. If you do not specify this

docs/reference/ml/anomaly-detection/apis/get-influencer.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ privileges. See <<security-privileges>> and
2727
==== {api-path-parms-title}
2828

2929
`<job_id>`::
30-
(Required, string) Identifier for the {anomaly-job}.
30+
(Required, string)
31+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
3132

3233
[[ml-get-influencer-request-body]]
3334
==== {api-request-body-title}

docs/reference/ml/anomaly-detection/apis/get-job-stats.asciidoc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,15 @@ IMPORTANT: This API returns a maximum of 10,000 jobs.
4040
==== {api-path-parms-title}
4141

4242
`<job_id>`::
43-
(Optional, string) An identifier for the {anomaly-job}. It can be a
44-
job identifier, a group name, or a wildcard expression. If you do not specify
45-
one of these options, the API returns statistics for all {anomaly-jobs}.
43+
(Optional, string)
44+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
4645

4746
[[ml-get-job-stats-query-parms]]
4847
==== {api-query-parms-title}
4948

5049
`allow_no_jobs`::
51-
(Optional, boolean) Specifies what to do when the request:
52-
+
53-
--
54-
* Contains wildcard expressions and there are no jobs that match.
55-
* Contains the `_all` string or no identifiers and there are no matches.
56-
* Contains wildcard expressions and there are only partial matches.
57-
58-
The default value is `true`, which returns an empty `jobs` array
59-
when there are no matches and the subset of results when there are partial
60-
matches. If this parameter is `false`, the request returns a `404` status code
61-
when there are no matches or only partial matches.
62-
--
50+
(Optional, boolean)
51+
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
6352

6453
[[ml-get-job-stats-results]]
6554
==== {api-response-body-title}
@@ -68,7 +57,6 @@ The API returns the following information:
6857

6958
`jobs`::
7059
(array) An array of {anomaly-job} statistics objects.
71-
For more information, see <<ml-jobstats>>.
7260

7361
[[ml-get-job-stats-response-codes]]
7462
==== {api-response-codes-title}

docs/reference/ml/anomaly-detection/apis/get-job.asciidoc

Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,40 @@ IMPORTANT: This API returns a maximum of 10,000 jobs.
4040
==== {api-path-parms-title}
4141

4242
`<job_id>`::
43-
(Optional, string) Identifier for the {anomaly-job}. It can be a job
44-
identifier, a group name, or a wildcard expression. If you do not specify one
45-
of these options, the API returns information for all {anomaly-jobs}.
43+
(Optional, string)
44+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
4645

4746
[[ml-get-job-query-parms]]
4847
==== {api-query-parms-title}
4948

5049
`allow_no_jobs`::
51-
(Optional, boolean) Specifies what to do when the request:
52-
+
53-
--
54-
* Contains wildcard expressions and there are no jobs that match.
55-
* Contains the `_all` string or no identifiers and there are no matches.
56-
* Contains wildcard expressions and there are only partial matches.
57-
58-
The default value is `true`, which returns an empty `jobs` array
59-
when there are no matches and the subset of results when there are partial
60-
matches. If this parameter is `false`, the request returns a `404` status code
61-
when there are no matches or only partial matches.
62-
--
50+
(Optional, boolean)
51+
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
6352

6453
[[ml-get-job-results]]
6554
==== {api-response-body-title}
6655

67-
The API returns the following information:
56+
The API returns an array of {anomaly-job} resources. For the full list of
57+
properties, see <<ml-put-job-request-body,create {anomaly-jobs} API>>.
6858

69-
`jobs`::
70-
(array) An array of {anomaly-job} resources.
71-
For more information, see <<ml-job-resource>>.
59+
`create_time`::
60+
(string) The time the job was created. For example, `1491007356077`. This
61+
property is informational; you cannot change its value.
62+
63+
`finished_time`::
64+
(string) If the job closed or failed, this is the time the job finished.
65+
Otherwise, it is `null`. This property is informational; you cannot change its
66+
value.
67+
68+
`job_type`::
69+
(string) Reserved for future use, currently set to `anomaly_detector`.
70+
71+
`job_version`::
72+
(string) The version of {es} that existed on the node when the job was created.
73+
74+
`model_snapshot_id`::
75+
(string)
76+
include::{docdir}/ml/ml-shared.asciidoc[tag=model-snapshot-id]
7277

7378
[[ml-get-job-response-codes]]
7479
==== {api-response-codes-title}
@@ -80,53 +85,65 @@ The API returns the following information:
8085
[[ml-get-job-example]]
8186
==== {api-examples-title}
8287

83-
The following example gets configuration information for the `total-requests` job:
84-
8588
[source,console]
8689
--------------------------------------------------
87-
GET _ml/anomaly_detectors/total-requests
90+
GET _ml/anomaly_detectors/high_sum_total_sales
8891
--------------------------------------------------
89-
// TEST[skip:setup:server_metrics_job]
92+
// TEST[skip:Kibana sample data]
9093

9194
The API returns the following results:
9295

93-
[source,console-result]
96+
[source,js]
9497
----
9598
{
9699
"count": 1,
97100
"jobs": [
98101
{
99-
"job_id": "total-requests",
100-
"job_type": "anomaly_detector",
101-
"job_version": "7.0.0-alpha1",
102-
"description": "Total sum of requests",
103-
"create_time": 1517011406091,
104-
"analysis_config": {
105-
"bucket_span": "10m",
106-
"detectors": [
102+
"job_id" : "high_sum_total_sales",
103+
"job_type" : "anomaly_detector",
104+
"job_version" : "7.5.0",
105+
"groups" : [
106+
"kibana_sample_data",
107+
"kibana_sample_ecommerce"
108+
],
109+
"description" : "Find customers spending an unusually high amount in an hour",
110+
"create_time" : 1577221534700,
111+
"analysis_config" : {
112+
"bucket_span" : "1h",
113+
"detectors" : [
107114
{
108-
"detector_description": "Sum of total",
109-
"function": "sum",
110-
"field_name": "total",
111-
"detector_index": 0
115+
"detector_description" : "High total sales",
116+
"function" : "high_sum",
117+
"field_name" : "taxful_total_price",
118+
"over_field_name" : "customer_full_name.keyword",
119+
"detector_index" : 0
112120
}
113121
],
114-
"influencers": [ ]
122+
"influencers" : [
123+
"customer_full_name.keyword",
124+
"category.keyword"
125+
]
126+
},
127+
"analysis_limits" : {
128+
"model_memory_limit" : "10mb",
129+
"categorization_examples_limit" : 4
130+
},
131+
"data_description" : {
132+
"time_field" : "order_date",
133+
"time_format" : "epoch_ms"
115134
},
116-
"analysis_limits": {
117-
"model_memory_limit": "1024mb",
118-
"categorization_examples_limit": 4
135+
"model_plot_config" : {
136+
"enabled" : true
119137
},
120-
"data_description": {
121-
"time_field": "timestamp",
122-
"time_format": "epoch_ms"
138+
"model_snapshot_retention_days" : 1,
139+
"custom_settings" : {
140+
"created_by" : "ml-module-sample",
141+
...
123142
},
124-
"model_snapshot_retention_days": 1,
125-
"results_index_name": "shared",
126-
"allow_lazy_open": false
143+
"model_snapshot_id" : "1575402237",
144+
"results_index_name" : "shared",
145+
"allow_lazy_open" : false
127146
}
128147
]
129148
}
130149
----
131-
// TESTRESPONSE[s/"7.0.0-alpha1"/$body.$_path/]
132-
// TESTRESPONSE[s/1517011406091/$body.$_path/]

docs/reference/ml/anomaly-detection/apis/get-overall-buckets.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ a span equal to the jobs' largest bucket span.
5555
==== {api-path-parms-title}
5656

5757
`<job_id>`::
58-
(Required, string) Identifier for the {anomaly-job}. It can be a job
59-
identifier, a group name, a comma-separated list of jobs or groups, or a
60-
wildcard expression.
58+
(Required, string)
59+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-wildcard-list]
6160

6261
[[ml-get-overall-buckets-request-body]]
6362
==== {api-request-body-title}
6463

6564
`allow_no_jobs`::
66-
(Optional, boolean) If `false` and the `job_id` does not match any
67-
{anomaly-jobs}, an error occurs. The default value is `true`.
65+
(Optional, boolean)
66+
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
6867

6968
`bucket_span`::
7069
(Optional, string) The span of the overall buckets. Must be greater or equal

docs/reference/ml/anomaly-detection/apis/get-record.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ privileges. See <<security-privileges>> and <<built-in-roles>>.
2626
==== {api-path-parms-title}
2727

2828
`<job_id>`::
29-
(Required, string) Identifier for the {anomaly-job}.
29+
(Required, string)
30+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
3031

3132
[[ml-get-record-request-body]]
3233
==== {api-request-body-title}

docs/reference/ml/anomaly-detection/apis/get-snapshot.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Retrieves information about model snapshots.
2626
==== {api-path-parms-title}
2727

2828
`<job_id>`::
29-
(Required, string) Identifier for the {anomaly-job}.
29+
(Required, string)
30+
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
3031

3132
`<snapshot_id>`::
3233
(Optional, string) Identifier for the model snapshot. If you do not specify

0 commit comments

Comments
 (0)