mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
HLRC: Adding ML Job stats (#33183)
* HLRC: Adding pojos for get job stats HLRC: Adding pojos for job stats request * HLRC: Adding job stats pojos * HLRC: ML job stats * Minor syntax changes and adding license headers * minor comment change * Moving to client package, minor changes * Addressing PR comments * removing bad sleep * addressing minor comment around test methods * adding toplevel random fields for tests * addressing minor review comments
This commit is contained in:
parent
f28cddf951
commit
19b14fa5ed
21 changed files with 1596 additions and 2 deletions
67
docs/java-rest/high-level/ml/get-job-stats.asciidoc
Normal file
67
docs/java-rest/high-level/ml/get-job-stats.asciidoc
Normal file
|
@ -0,0 +1,67 @@
|
|||
[[java-rest-high-x-pack-ml-get-job-stats]]
|
||||
=== Get Job Stats API
|
||||
|
||||
The Get Job Stats API provides the ability to get any number of
|
||||
{ml} job's statistics in the cluster.
|
||||
It accepts a `GetJobStatsRequest` object and responds
|
||||
with a `GetJobStatsResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-job-stats-request]]
|
||||
==== Get Job Stats Request
|
||||
|
||||
A `GetJobsStatsRequest` object can have any number of `jobId`
|
||||
entries. However, they all must be non-null. An empty list is the same as
|
||||
requesting statistics for all jobs.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-job-stats-request]
|
||||
--------------------------------------------------
|
||||
<1> Constructing a new request referencing existing `jobIds`, can contain wildcards
|
||||
<2> Whether to ignore if a wildcard expression matches no jobs.
|
||||
(This includes `_all` string or when no jobs have been specified)
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-job-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-job-stats-execute]
|
||||
--------------------------------------------------
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-job-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-job-stats-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `GetJobsStatsRequest` 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 `GetJobsStatsResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-job-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-job-stats-response]]
|
||||
==== Get Job Stats Response
|
||||
The returned `GetJobStatsResponse` contains the requested job statistics:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-job-stats-response]
|
||||
--------------------------------------------------
|
||||
<1> `getCount()` indicates the number of jobs statistics found
|
||||
<2> `getJobStats()` is the collection of {ml} `JobStats` objects found
|
|
@ -211,6 +211,7 @@ The Java High Level REST Client supports the following Machine Learning APIs:
|
|||
* <<java-rest-high-x-pack-ml-delete-job>>
|
||||
* <<java-rest-high-x-pack-ml-open-job>>
|
||||
* <<java-rest-high-x-pack-ml-close-job>>
|
||||
* <<java-rest-high-x-pack-ml-get-job-stats>>
|
||||
* <<java-rest-high-x-pack-ml-get-buckets>>
|
||||
* <<java-rest-high-x-pack-ml-get-records>>
|
||||
|
||||
|
@ -219,6 +220,7 @@ include::ml/get-job.asciidoc[]
|
|||
include::ml/delete-job.asciidoc[]
|
||||
include::ml/open-job.asciidoc[]
|
||||
include::ml/close-job.asciidoc[]
|
||||
include::ml/get-job-stats.asciidoc[]
|
||||
include::ml/get-buckets.asciidoc[]
|
||||
include::ml/get-records.asciidoc[]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue