Skip to content

Commit a1f4c83

Browse files
committed
[DOCS] Amends data frame analytics resources, GET, and PUT API docs (#44806)
This PR addresses the feedback in elastic/ml-team#175 (comment). * Adds an example to `analyzed_fields` * Includes `source` and `dest` objects inline in the resource page * Lists `model_memory_limit` in the PUT API page * Amends the `analysis` section in the resource page * Removes Properties headings in subsections
1 parent 1eb0958 commit a1f4c83

File tree

4 files changed

+102
-68
lines changed

4 files changed

+102
-68
lines changed

docs/reference/ml/df-analytics/apis/dfanalyticsresources.asciidoc

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,36 @@
1818
(object) You can specify both `includes` and/or `excludes` patterns. If
1919
`analyzed_fields` is not set, only the relevant fields will be included. For
2020
example all the numeric fields for {oldetection}.
21+
22+
[source,js]
23+
--------------------------------------------------
24+
PUT _ml/data_frame/analytics/loganalytics
25+
{
26+
"source": {
27+
"index": "logdata"
28+
},
29+
"dest": {
30+
"index": "logdata_out"
31+
},
32+
"analysis": {
33+
"outlier_detection": {
34+
}
35+
},
36+
"analyzed_fields": {
37+
"includes": [ "request.bytes", "response.counts.error" ],
38+
"excludes": [ "source.geo" ]
39+
}
40+
}
41+
--------------------------------------------------
42+
// CONSOLE
43+
// TEST[setup:setup_logdata]
2144

2245
`dest`::
23-
(object) The destination configuration of the analysis. For more information,
24-
see <<dfanalytics-dest-resources>>.
46+
(object) The destination configuration of the analysis. The `index` property
47+
(string) is the name of the index in which to store the results of the
48+
{dfanalytics-job}. The `results_field` (string) property defines the name of
49+
the field in which to store the results of the analysis. The default value is
50+
`ml`.
2551

2652
`id`::
2753
(string) The unique identifier for the {dfanalytics-job}. This identifier can
@@ -38,25 +64,29 @@
3864
that setting. For more information, see <<ml-settings>>.
3965

4066
`source`::
41-
(object) The source configuration, consisting of `index` and optionally a
42-
`query`. For more information, see <<dfanalytics-source-resources>>.
67+
(object) The source configuration, consisting of `index` (array) which is an
68+
array of index names on which to perform the analysis. It can be a single
69+
index or index pattern as well as an array of indices or patterns. Optionally,
70+
`source` can have a `query` (object) property. The {es} query domain-specific
71+
language (DSL). This value corresponds to the query object in an {es} search
72+
POST body. All the options that are supported by {es} can be used, as this
73+
object is passed verbatim to {es}. By default, this property has the following
74+
value: `{"match_all": {}}`.
4375

4476
[[dfanalytics-types]]
4577
==== Analysis objects
4678

4779
{dfanalytics-cap} resources contain `analysis` objects. For example, when you
48-
create a {dfanalytics-job}, you must define the type of analysis it performs.
80+
create a {dfanalytics-job}, you must define the type of analysis it performs.
81+
Currently, `outlier_detection` is the only available type of analysis, however,
82+
other types will be added, for example `regression`.
4983

5084
[discrete]
5185
[[oldetection-resources]]
52-
===== {oldetection-cap} configuration objects
86+
==== {oldetection-cap} configuration objects
5387

5488
An {oldetection} configuration object has the following properties:
5589

56-
[discrete]
57-
[[oldetection-properties]]
58-
==== {api-definitions-title}
59-
6090
`n_neighbors`::
6191
(integer) Defines the value for how many nearest neighbors each method of
6292
{oldetection} will use to calculate its {olscore}. When the value is
@@ -65,44 +95,11 @@ An {oldetection} configuration object has the following properties:
6595
`method`::
6696
(string) Sets the method that {oldetection} uses. If the method is not set
6797
{oldetection} uses an ensemble of different methods and normalises and
68-
combines their individual {olscores} to obtain the overall {olscore}.
69-
Available methods are `lof`, `ldof`, `distance_kth_nn`, `distance_knn`.
98+
combines their individual {olscores} to obtain the overall {olscore}. We
99+
recommend to use the ensemble method. Available methods are `lof`, `ldof`,
100+
`distance_kth_nn`, `distance_knn`.
70101

71102
`feature_influence_threshold`::
72103
(double) The minimum {olscore} that a document needs to have in order to
73104
calculate its {fiscore}.
74-
Value range: 0-1 (`0.1` by default).
75-
76-
[[dfanalytics-dest-resources]]
77-
==== Dest configuration objects
78-
79-
{dfanalytics-cap} resources contain `dest` objects. For example, when you
80-
create a {dfanalytics-job}, you must define its destination.
81-
82-
[discrete]
83-
[[dfanalytics-dest-properties]]
84-
==== {api-definitions-title}
85-
86-
`index`::
87-
(string) The name of the index in which to store the results of the
88-
{dfanalytics-job}.
89-
90-
`results_field`::
91-
(string) The name of the field in which to store the results of the analysis.
92-
The default value is `ml`.
93-
94-
[[dfanalytics-source-resources]]
95-
==== Source configuration objects
96-
97-
The `source` configuration object has the following properties:
98-
99-
`index`::
100-
(array) An array of index names on which to perform the analysis. It can be a
101-
single index or index pattern as well as an array of indices or patterns.
102-
103-
`query`::
104-
(object) The {es} query domain-specific language (DSL). This value
105-
corresponds to the query object in an {es} search POST body. All the
106-
options that are supported by {es} can be used, as this object is
107-
passed verbatim to {es}. By default, this property has the following
108-
value: `{"match_all": {}}`.
105+
Value range: 0-1 (`0.1` by default).

docs/reference/ml/df-analytics/apis/get-dfanalytics-stats.asciidoc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,18 @@ information, see {stack-ov}/security-privileges.html[Security privileges] and
4343
==== {api-query-parms-title}
4444

4545
`allow_no_match`::
46-
(Optional, boolean) If `false` and the `data_frame_analytics_id` does not
47-
match any {dfanalytics-job} an error will be returned. The default value is
48-
`true`.
46+
(Optional, boolean) Specifies what to do when the request:
47+
+
48+
--
49+
* Contains wildcard expressions and there are no {dfanalytics-jobs} that match.
50+
* Contains the `_all` string or no identifiers and there are no matches.
51+
* Contains wildcard expressions and there are only partial matches.
52+
53+
The default value is `true`, which returns an empty `data_frame_analytics` array
54+
when there are no matches and the subset of results when there are partial
55+
matches. If this parameter is `false`, the request returns a `404` status code
56+
when there are no matches or only partial matches.
57+
--
4958

5059
`from`::
5160
(Optional, integer) Skips the specified number of {dfanalytics-jobs}. The
@@ -64,6 +73,13 @@ The API returns the following information:
6473
(array) An array of statistics objects for {dfanalytics-jobs}, which are
6574
sorted by the `id` value in ascending order.
6675

76+
[[ml-get-dfanalytics-stats-response-codes]]
77+
==== {api-response-codes-title}
78+
79+
`404` (Missing resources)::
80+
If `allow_no_match` is `false`, this code indicates that there are no
81+
resources that match the request or only partial matches for the request.
82+
6783
[[ml-get-dfanalytics-stats-example]]
6884
==== {api-examples-title}
6985

docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,42 @@ information, see {stack-ov}/security-privileges.html[Security privileges] and
3333
==== {api-description-title}
3434

3535
You can get information for multiple {dfanalytics-jobs} in a single API request
36-
by using a comma-separated list of {dfanalytics-jobs} or a wildcard expression.
37-
You can get information for all {dfanalytics-jobs} by using _all, by specifying
38-
`*` as the `<data_frame_analytics_id>`, or by omitting the
39-
`<data_frame_analytics_id>`.
36+
by using a comma-separated list of {dfanalytics-jobs} or a wildcard expression.
4037

4138
[[ml-get-dfanalytics-path-params]]
4239
==== {api-path-parms-title}
4340

4441
`<data_frame_analytics_id>`::
4542
(Optional, string) Identifier for the {dfanalytics-job}. If you do not specify
4643
one of these options, the API returns information for the first hundred
47-
{dfanalytics-jobs}.
48-
49-
`allow_no_match` (Optional)::
50-
(boolean) If `false` and the `data_frame_analytics_id` does not match any
51-
{dfanalytics-job} an error will be returned. The default value is `true`.
44+
{dfanalytics-jobs}. You can get information for all {dfanalytics-jobs} by
45+
using _all, by specifying `*` as the `<data_frame_analytics_id>`, or by
46+
omitting the `<data_frame_analytics_id>`.
5247

5348
[[ml-get-dfanalytics-query-params]]
5449
==== {api-query-parms-title}
5550

5651
`allow_no_match`::
57-
(Optional, boolean) If `false` and the `data_frame_analytics_id` does not
58-
match any {dfanalytics-job} an error will be returned. The default value is
59-
`true`.
52+
(Optional, boolean) Specifies what to do when the request:
53+
+
54+
--
55+
* Contains wildcard expressions and there are no {dfanalytics-jobs} that match.
56+
* Contains the `_all` string or no identifiers and there are no matches.
57+
* Contains wildcard expressions and there are only partial matches.
58+
59+
The default value is `true`, which returns an empty `data_frame_analytics` array
60+
when there are no matches and the subset of results when there are partial
61+
matches. If this parameter is `false`, the request returns a `404` status code
62+
when there are no matches or only partial matches.
63+
--
6064

6165
`from`::
6266
(Optional, integer) Skips the specified number of {dfanalytics-jobs}. The
6367
default value is `0`.
6468

6569
`size`::
66-
(Optional, integer) Specifies the maximum number of {dfanalytics-jobs} to obtain. The
67-
default value is `100`.
70+
(Optional, integer) Specifies the maximum number of {dfanalytics-jobs} to
71+
obtain. The default value is `100`.
6872

6973
[[ml-get-dfanalytics-results]]
7074
==== {api-response-body-title}
@@ -73,6 +77,13 @@ You can get information for all {dfanalytics-jobs} by using _all, by specifying
7377
(array) An array of {dfanalytics-job} resources. For more information, see
7478
<<ml-dfanalytics-resources>>.
7579

80+
[[ml-get-dfanalytics-response-codes]]
81+
==== {api-response-codes-title}
82+
83+
`404` (Missing resources)::
84+
If `allow_no_match` is `false`, this code indicates that there are no
85+
resources that match the request or only partial matches for the request.
86+
7687
[[ml-get-dfanalytics-example]]
7788
==== {api-examples-title}
7889

docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,22 @@ and mappings.
6767
example, all the numeric fields for {oldetection}.
6868

6969
`dest`::
70-
(Required, object) The destination configuration, consisting of `index` and optionally
71-
`results_field` (`ml` by default). See <<dfanalytics-dest-resources>>.
70+
(Required, object) The destination configuration, consisting of `index` and
71+
optionally `results_field` (`ml` by default). See
72+
<<ml-dfanalytics-properties,{dfanalytics} properties>>.
73+
74+
`model_memory_limit`::
75+
(Optional, string) The approximate maximum amount of memory resources that are
76+
permitted for analytical processing. The default value for {dfanalytics-jobs}
77+
is `1gb`. If your `elasticsearch.yml` file contains an
78+
`xpack.ml.max_model_memory_limit` setting, an error occurs when you try to
79+
create {dfanalytics-jobs} that have `model_memory_limit` values greater than
80+
that setting. For more information, see <<ml-settings>>.
7281

7382
`source`::
74-
(Required, object) The source configuration, consisting of `index` and optionally a
75-
`query`. See <<dfanalytics-source-resources>>.
83+
(Required, object) The source configuration, consisting of `index` and
84+
optionally a `query`. See
85+
<<ml-dfanalytics-properties,{dfanalytics} properties>>.
7686

7787
[[ml-put-dfanalytics-example]]
7888
==== {api-examples-title}

0 commit comments

Comments
 (0)