Skip to content

[DOCS] Move datafeed resource definitions into APIs #50005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 0 additions & 161 deletions docs/reference/ml/anomaly-detection/apis/datafeedresource.asciidoc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ can delete it.
==== {api-path-parms-title}

`<feed_id>`::
(Required, string) Identifier for the {dfeed}.
(Required, string)
include::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id]

[[ml-delete-datafeed-query-parms]]
==== {api-query-parms-title}

`force`::
(Optional, boolean) Use to forcefully delete a started {dfeed}; this method is
quicker than stopping and deleting the {dfeed}.
(Optional, boolean) Use to forcefully delete a started {dfeed}; this method is
quicker than stopping and deleting the {dfeed}.

[[ml-delete-datafeed-example]]
==== {api-examples-title}
Expand Down
109 changes: 67 additions & 42 deletions docs/reference/ml/anomaly-detection/apis/get-datafeed-stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,61 @@ IMPORTANT: This API returns a maximum of 10,000 {dfeeds}.
==== {api-path-parms-title}

`<feed_id>`::
(Optional, string) Identifier for the {dfeed}. It can be a {dfeed} identifier
or a wildcard expression. If you do not specify one of these options, the API
returns statistics for all {dfeeds}.
(Optional, string)
include::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id-wildcard]
If you do not specify one of these options, the API returns information about
all {dfeeds}.

[[ml-get-datafeed-stats-query-parms]]
==== {api-query-parms-title}

`allow_no_datafeeds`::
(Optional, boolean) Specifies what to do when the request:
+
--
* Contains wildcard expressions and there are no {datafeeds} that match.
* Contains the `_all` string or no identifiers and there are no matches.
* Contains wildcard expressions and there are only partial matches.

The default value is `true`, which returns an empty `datafeeds` array when
there are no matches and the subset of results when there are partial matches.
If this parameter is `false`, the request returns a `404` status code when there
are no matches or only partial matches.
--
(Optional, boolean)
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-datafeeds]


[[ml-get-datafeed-stats-results]]
==== {api-response-body-title}

The API returns the following information:
The API returns an array of {dfeed} count objects. All of these properties are
informational; you cannot update their values.

`assignment_explanation`::
(string) For started {dfeeds} only, contains messages relating to the selection of a node.

`datafeed_id`::
(string)
include::{docdir}/ml/ml-shared.asciidoc[tag=datafeed-id]

`node`::
(object) For started {dfeeds} only, the node upon which the {dfeed} is started. The {dfeed} and job will be on the same node.
`id`::: The unique identifier of the node. For example, "0-o0tOoRTwKFZifatTWKNw".
`name`::: The node name. For example, `0-o0tOo`.
`ephemeral_id`::: The node ephemeral ID.
`transport_address`::: The host and port where transport HTTP connections are
accepted. For example, `127.0.0.1:9300`.
`attributes`::: For example, `{"ml.machine_memory": "17179869184"}`.

`state`::
(string) The status of the {dfeed}, which can be one of the following values:
+
--
* `started`: The {dfeed} is actively receiving data.
* `stopped`: The {dfeed} is stopped and will not receive data until it is
re-started.
--

`timing_stats`::
(object) An object that provides statistical information about timing aspect of
this {dfeed}.
//average_search_time_per_bucket_ms
//bucket_count
//exponential_average_search_time_per_hour_ms
`job_id`:::
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
`search_count`::: Number of searches performed by this {dfeed}.
`total_search_time_ms`::: Total time the {dfeed} spent searching in milliseconds.

`datafeeds`::
(array) An array of {dfeed} count objects.
For more information, see <<ml-datafeed-counts>>.

[[ml-get-datafeed-stats-response-codes]]
==== {api-response-codes-title}
Expand All @@ -86,46 +111,46 @@ The API returns the following information:
[[ml-get-datafeed-stats-example]]
==== {api-examples-title}

The following example gets usage information for the
`datafeed-total-requests` {dfeed}:

[source,console]
--------------------------------------------------
GET _ml/datafeeds/datafeed-total-requests/_stats
GET _ml/datafeeds/datafeed-high_sum_total_sales/_stats
--------------------------------------------------
// TEST[skip:setup:server_metrics_startdf]
// TEST[skip:Kibana sample data started datafeed]

The API returns the following results:

[source,console-result]
----
{
"count": 1,
"datafeeds": [
"count" : 1,
"datafeeds" : [
{
"datafeed_id": "datafeed-total-requests",
"state": "started",
"node": {
"id": "2spCyo1pRi2Ajo-j-_dnPX",
"name": "node-0",
"ephemeral_id": "hoXMLZB0RWKfR9UPPUCxXX",
"transport_address": "127.0.0.1:9300",
"attributes": {
"ml.machine_memory": "17179869184",
"ml.max_open_jobs": "20"
"datafeed_id" : "datafeed-high_sum_total_sales",
"state" : "started",
"node" : {
"id" : "7bmMXyWCRs-TuPfGJJ_yMw",
"name" : "node-0",
"ephemeral_id" : "hoXMLZB0RWKfR9UPPUCxXX",
"transport_address" : "127.0.0.1:9300",
"attributes" : {
"ml.machine_memory" : "17179869184",
"ml.max_open_jobs" : "20"
}
},
"assignment_explanation": "",
"timing_stats": {
"job_id": "job-total-requests",
"search_count": 20,
"total_search_time_ms": 120.5
"assignment_explanation" : "",
"timing_stats" : {
"job_id" : "high_sum_total_sales",
"search_count" : 7,
"bucket_count" : 743,
"total_search_time_ms" : 134.0,
"average_search_time_per_bucket_ms" : 0.180349932705249,
"exponential_average_search_time_per_hour_ms" : 11.514712961628677
}
}
]
}
----
// TESTRESPONSE[s/"2spCyo1pRi2Ajo-j-_dnPX"/$body.$_path/]
// TESTRESPONSE[s/"7bmMXyWCRs-TuPfGJJ_yMw"/$body.$_path/]
// TESTRESPONSE[s/"node-0"/$body.$_path/]
// TESTRESPONSE[s/"hoXMLZB0RWKfR9UPPUCxXX"/$body.$_path/]
// TESTRESPONSE[s/"127.0.0.1:9300"/$body.$_path/]
Expand Down
Loading