2019-07-05 07:34:05 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="platinum"]
|
|
|
|
[[get-dfanalytics-stats]]
|
|
|
|
=== Get {dfanalytics-jobs} statistics API
|
|
|
|
[subs="attributes"]
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get {dfanalytics-jobs} stats</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
Retrieves usage information for {dfanalytics-jobs}.
|
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
experimental[]
|
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
[[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`
|
|
|
|
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
[[ml-get-dfanalytics-stats-prereq]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* You must have `monitor_ml` privilege to use this API. For more
|
2019-10-07 18:23:19 -04:00
|
|
|
information, see <<security-privileges>> and <<built-in-roles>>.
|
2019-07-05 07:34:05 -04:00
|
|
|
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
[[ml-get-dfanalytics-stats-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<data_frame_analytics_id>`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(Optional, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-data-frame-analytics-default]
|
2019-07-05 07:34:05 -04:00
|
|
|
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
[[ml-get-dfanalytics-stats-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`allow_no_match`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(Optional, boolean)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=allow-no-match]
|
2019-07-10 20:58:17 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`from`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(Optional, integer)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=from]
|
2019-07-05 07:34:05 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`size`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(Optional, integer)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=size]
|
2019-07-05 07:34:05 -04:00
|
|
|
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
[[ml-get-dfanalytics-stats-response-body]]
|
|
|
|
==== {api-response-body-title}
|
|
|
|
|
|
|
|
The API returns the following information:
|
|
|
|
|
|
|
|
`data_frame_analytics`::
|
2019-12-13 05:48:21 -05:00
|
|
|
(array)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=data-frame-analytics-stats]
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
|
2019-07-26 05:39:59 -04:00
|
|
|
[[ml-get-dfanalytics-stats-response-codes]]
|
|
|
|
==== {api-response-codes-title}
|
|
|
|
|
|
|
|
`404` (Missing resources)::
|
|
|
|
If `allow_no_match` is `false`, this code indicates that there are no
|
|
|
|
resources that match the request or only partial matches for the request.
|
|
|
|
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
[[ml-get-dfanalytics-stats-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
2019-09-09 12:35:50 -04:00
|
|
|
[source,console]
|
2019-07-05 07:34:05 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
GET _ml/data_frame/analytics/loganalytics/_stats
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:TBD]
|
|
|
|
|
2019-09-06 09:17:18 -04:00
|
|
|
|
2019-07-05 07:34:05 -04:00
|
|
|
The API returns the following results:
|
|
|
|
|
2019-09-06 09:22:08 -04:00
|
|
|
[source,console-result]
|
2019-07-05 07:34:05 -04:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"count": 1,
|
|
|
|
"data_frame_analytics": [
|
|
|
|
{
|
|
|
|
"id": "loganalytics",
|
[7.x][ML] Improve progress reportings for DF analytics (#45856) (#45910)
Previously, the stats API reports a progress percentage
for DF analytics tasks that are running and are in the
`reindexing` or `analyzing` state.
This means that when the task is `stopped` there is no progress
reported. Thus, one cannot distinguish between a task that never
run to one that completed.
In addition, there are blind spots in the progress reporting.
In particular, we do not account for when data is loaded into the
process. We also do not account for when results are written.
This commit addresses the above issues. It changes progress
to being a list of objects, each one describing the phase
and its progress as a percentage. We currently have 4 phases:
reindexing, loading_data, analyzing, writing_results.
When the task stops, progress is persisted as a document in the
state index. The stats API now reports progress from in-memory
if the task is running, or returns the persisted document
(if there is one).
2019-08-23 16:04:39 -04:00
|
|
|
"state": "stopped",
|
|
|
|
"progress": [
|
|
|
|
{
|
|
|
|
"phase": "reindexing",
|
|
|
|
"progress_percent": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"phase": "loading_data",
|
|
|
|
"progress_percent": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"phase": "analyzing",
|
|
|
|
"progress_percent": 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"phase": "writing_results",
|
|
|
|
"progress_percent": 0
|
|
|
|
}
|
|
|
|
]
|
2019-07-05 07:34:05 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|