Skip to content
57 changes: 57 additions & 0 deletions docs/reference/ml/apis/delete-dfanalytics.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
role="xpack"]
[testenv="platinum"]
[[delete-dfanalytics]]
=== Delete {dfanalytics} API

[subs="attributes"]
++++
<titleabbrev>Delete {dfanalytics}</titleabbrev>
++++

beta[]

Deletes an existing {dfanalytics} job.

[discrete]
[[ml-delete-dfanalytics-request]]
==== {api-request-title}

`DELETE _ml/data_frame/analytics/<data_frame_analytics_id>`

[discrete]
[[ml-delete-dfanalytics-prereq]]
==== {api-prereq-title}

You must have `machine_learning_admin` built-in role to use this API. For more
information, see {stack-ov}/security-privileges.html[Security privileges] and
{stack-ov}/built-in-roles.html[Built-in roles].

[discrete]
[[ml-delete-dfanalytics-path-params]]
==== {api-path-parms-title}

`<data_frame_analytics_id>`::
(string) Identifier for the {dfanalytics} job you want to delete.

[discrete]
[[ml-delete-dfanalytics-example]]
==== {api-example-title}

The following example deletes the `loganalytics` {dfanalytics} job:

[source,js]
--------------------------------------------------
DELETE _ml/data_frame/analytics/loganalytics
--------------------------------------------------
// CONSOLE
// TEST

The API returns the following result:

[source,js]
----
{
"acknowledged" : true
}
----
// TESTRESPONSE
103 changes: 103 additions & 0 deletions docs/reference/ml/apis/evaluate-dfanalytics.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
role="xpack"]
[testenv="platinum"]
[[evaluate-dataframe]]
=== Evaluate {dataframe} API

[subs="attributes"]
++++
<titleabbrev>Evaluate {dataframe}</titleabbrev>
++++

beta[]

Evaluates the executed analysis on an index that is already annotated with a
field that marks each {datafame} row with the results of the analytics.

[discrete]
[[ml-evaluate-dataframe-request]]
==== {api-request-title}

`POST _ml/data_frame/_evaluate`

[discrete]
[[ml-evaluate-dataframe-prereq]]
==== {api-prereq-title}

You must have `monitor_ml` privilege to use this API. For more
information, see {stack-ov}/security-privileges.html[Security privileges] and
{stack-ov}/built-in-roles.html[Built-in roles].

[discrete]
[[ml-evaluate-dataframe-request-body]]
==== {api-request-body-title}

`index` (required)::
(object) Defines the `index` in which the evaluation will be performed.

`evaluation` (required)::
(object) Defines the type of evaluation you want to perform. For example:
`binary_soft_classification`.
See evaluate API resources.

[discrete]
[[ml-evaluate-dataframe-example]]
==== {api-example-title}

[source,js]
--------------------------------------------------
POST _ml/data_frame/_evaluate

{
"index": "my_analytics_dest_index"
"evaluation": {
"binary_soft_classification": {
"actual_field": "is_outlier"
"predicted_probability_field": "ml.outlier_score"
}
}
}
--------------------------------------------------
// CONSOLE
// TEST

The API returns the following results:

[source,js]
----
{
"binary_soft_classification": {
"auc_roc": {
"score": 0.92584757746414444
},
"confusion_matrix": {
"0.25": {
"tp": 5,
"fp": 9,
"tn": 204,
"fn": 5
},
"0.5": {
"tp": 1,
"fp": 5,
"tn": 208,
"fn": 9
},
"0.75": {
"tp": 0,
"fp": 4,
"tn": 209,
"fn": 10
}
},
"precision": {
"0.25": 0.35714285714285715,
"0.5": 0.16666666666666666,
"0.75": 0
},
"recall": {
"0.25": 0.5,
"0.5": 0.1,
"0.75": 0
}
}
}
87 changes: 87 additions & 0 deletions docs/reference/ml/apis/get-dfanalytics-stats.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[role="xpack"]
[testenv="platinum"]
[[get-dfanalytics-stats]]
=== Get {dfanalytics} statistics API
++++
<titleabbrev>Get {dfanalytics} stats</titleabbrev>
++++

beta[]

Retrieves usage information for {dfanalytics}.

[discrete]
[[ml-get-dfanalytics-stats-request]]
==== {api-request-title}

`GET _ml/data_frame/analytics/<data_frame_analytics_id>/_stats` +
`GET _ml/data_frame/analytics/<data_frame_analytics_id>,<data_frame_analytics_id>/_stats` +
`GET _ml/data_frame/analytics/_stats` +
`GET _ml/data_frame/analytics/_all/_stats` +
`GET _ml/data_frame/analytics/*/_stats`

[discrete]
[[ml-get-dfanalytics-stats-prereq]]
==== {api-prereq-title}

You must have `monitor_ml` privilege to use this API. For more
information, see {stack-ov}/security-privileges.html[Security privileges] and
{stack-ov}/built-in-roles.html[Built-in roles].

[discrete]
[[ml-get-dfanalytics-stats-path-params]]
==== {api-path-parms-title}

`<data_frame_analytics_id>`::
(string) Identifier for the {dfanalytics} job. If you do not specify one of
these options, the API returns information for the first hundred {dfanalytics}
jobs.

[discrete]
[[ml-get-dfanalytics-stats-query-params]]
==== {api-query-parms-title}

`from` (optional)::
(integer) Skips the specified number of {dfanalytics} jobs. The default value
is `0`.

`size`(optional)::
(integer) Specifies the maximum number of {dfanalytics} jobs to obtain. The
default value is `100`.

[discrete]
[[ml-get-dfanalytics-stats-response-body]]
==== {api-response-body-title}

The API returns the following information:

`data_frame_analytics`::
(array) An array of statistics objects for {dfanalytics}, which are
sorted by the `id` value in ascending order.

[discrete]
[[ml-get-dfanalytics-stats-example]]
==== {api-example-title}

[source,js]
--------------------------------------------------
GET _ml/data_frame/analytics/loganalytics/_stats
--------------------------------------------------
// CONSOLE
// TEST

The API returns the following results:

[source,js]
----
{
"count": 1,
"data_frame_analytics": [
{
"id": "loganalytics",
"state": "stopped"
}
]
}
----
// TESTRESPONSE
101 changes: 101 additions & 0 deletions docs/reference/ml/apis/get-dfanalytics.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[role="xpack"]
[testenv="platinum"]
[[ml-get-dfanalytics]]
=== Get {dfanalytics} API
++++
<titleabbrev>Get {dfanalytics}</titleabbrev>
++++

beta[]

Retrieves configuration information for {dfanalytics}.

[discrete]
[[ml-get-dfanalytics-request]]
==== {api-request-title}

`GET _ml/data_frame/analytics/<data_frame_analytics_id>` +
`GET _ml/data_frame/analytics/<data_frame_analytics_id>,<data_frame_analytics_id>` +
`GET _ml/data_frame/analytics/` +
`GET _ml/data_frame/analytics/_all`

[discrete]
[[ml-get-dfanalytics-prereq]]
==== {api-prereq-title}

You must have `monitor_ml` privilege to use this API. For more
information, see {stack-ov}/security-privileges.html[Security privileges] and
{stack-ov}/built-in-roles.html[Built-in roles].

[discrete]
[[ml-get-dfanalytics-desc]]
==== {api-description-title}

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

[discrete]
[[ml-get-dfanalytics-path-params]]
==== {api-path-parms-title}

`<data_frame_analytics_id>`::
(string) Identifier for the {dfanalytics} job. If you do not specify one of
these options, the API returns information for the first hundred {dfanalytics}
jobs.

[discrete]
[[ml-get-dfanalytics-query-params]]
==== {api-query-parms-title}

`from` (optional)::
(integer) Skips the specified number of {dfanalytics} jobs. The default value
is `0`.

`size` (optional)::
(integer) Specifies the maximum number of {dfanalytics} jobs to obtain. The
default value is `100`.

[discrete]
[[ml-get-dfanalytics-example]]
==== {api-example-title}

The following example gets configuration information for the `loganalytics`
{dfanalytics} job:

[source,js]
--------------------------------------------------
GET _ml/data_frame/analytics/loganalytics
--------------------------------------------------
// CONSOLE
// TEST[skip:set up kibana samples]

The API returns the following results:

[source,js]
----
{
"count": 1,
"data_frame_analytics": [
{
"id": "loganalytics",
"source": {
"index": "logdata",
"query": {
"match_all": {}
}
},
"dest": {
"index": "logdata_out",
"results_field": "ml"
},
"analysis": {
"outlier_detection": {}
},
"model_memory_limit": "1gb"
}
]
}
----
// TESTRESPONSE
Loading