mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
HLRC: ML Adding get datafeed stats API (#34271)
* HLRC: ML Adding get datafeed stats API * addressing PR comments * fixing field exclusion filter * removing unnecessary whitespace
This commit is contained in:
parent
a6c5b6807f
commit
026488bcbf
14 changed files with 919 additions and 1 deletions
67
docs/java-rest/high-level/ml/get-datafeed-stats.asciidoc
Normal file
67
docs/java-rest/high-level/ml/get-datafeed-stats.asciidoc
Normal file
|
@ -0,0 +1,67 @@
|
|||
[[java-rest-high-x-pack-ml-get-datafeed-stats]]
|
||||
=== Get Datafeed Stats API
|
||||
|
||||
The Get Datafeed Stats API provides the ability to get any number of
|
||||
{ml} datafeed's statistics in the cluster.
|
||||
It accepts a `GetDatafeedStatsRequest` object and responds
|
||||
with a `GetDatafeedStatsResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-datafeed-stats-request]]
|
||||
==== Get Datafeed Stats Request
|
||||
|
||||
A `GetDatafeedStatsRequest` object can have any number of `datafeedId`
|
||||
entries. However, they all must be non-null. An empty list is the same as
|
||||
requesting statistics for all datafeeds.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-datafeed-stats-request]
|
||||
--------------------------------------------------
|
||||
<1> Constructing a new request referencing existing `datafeedIds`, can contain wildcards
|
||||
<2> Whether to ignore if a wildcard expression matches no datafeeds.
|
||||
(This includes `_all` string or when no datafeeds have been specified)
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-datafeed-stats-execution]]
|
||||
==== Execution
|
||||
|
||||
The request can be executed through the `MachineLearningClient` contained
|
||||
in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-datafeed-stats-execute]
|
||||
--------------------------------------------------
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-datafeed-stats-execution-async]]
|
||||
==== Asynchronous Execution
|
||||
|
||||
The request can also be executed asynchronously:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-datafeed-stats-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `GetDatafeedStatsRequest` to execute and the `ActionListener` to use when
|
||||
the execution completes
|
||||
|
||||
The method does not block and returns immediately. The passed `ActionListener` is used
|
||||
to notify the caller of completion. A typical `ActionListener` for `GetDatafeedStatsResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-datafeed-stats-listener]
|
||||
--------------------------------------------------
|
||||
<1> `onResponse` is called back when the action is completed successfully
|
||||
<2> `onFailure` is called back when some unexpected error occurs
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-datafeed-stats-response]]
|
||||
==== Get Datafeed Stats Response
|
||||
The returned `GetDatafeedStatsResponse` contains the requested datafeed statistics:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-datafeed-stats-response]
|
||||
--------------------------------------------------
|
||||
<1> `count()` indicates the number of datafeeds statistics found
|
||||
<2> `datafeedStats()` is the collection of {ml} `DatafeedStats` objects found
|
|
@ -238,6 +238,7 @@ The Java High Level REST Client supports the following Machine Learning APIs:
|
|||
* <<{upid}-preview-datafeed>>
|
||||
* <<{upid}-start-datafeed>>
|
||||
* <<{upid}-stop-datafeed>>
|
||||
* <<{upid}-get-datafeed-stats>>
|
||||
* <<{upid}-forecast-job>>
|
||||
* <<{upid}-delete-forecast>>
|
||||
* <<{upid}-get-buckets>>
|
||||
|
@ -263,6 +264,7 @@ include::ml/delete-datafeed.asciidoc[]
|
|||
include::ml/preview-datafeed.asciidoc[]
|
||||
include::ml/start-datafeed.asciidoc[]
|
||||
include::ml/stop-datafeed.asciidoc[]
|
||||
include::ml/get-datafeed-stats.asciidoc[]
|
||||
include::ml/get-job-stats.asciidoc[]
|
||||
include::ml/forecast-job.asciidoc[]
|
||||
include::ml/delete-forecast.asciidoc[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue