mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
HLRC: Add ML Get Job (#32960)
* HLRC: Adding GET ML Job info API * HLRC: Adding GET Job ML API * Fixing QueryPage license header * Adding serialization tests, addressing minor issues * Renaming querypage, changing the dependency on it * Making things immutable * Fixing build failure due to method rename
This commit is contained in:
parent
07b3ff9fe7
commit
e2ea83d217
13 changed files with 670 additions and 2 deletions
57
docs/java-rest/high-level/ml/get-job.asciidoc
Normal file
57
docs/java-rest/high-level/ml/get-job.asciidoc
Normal file
|
@ -0,0 +1,57 @@
|
|||
[[java-rest-high-x-pack-ml-get-job]]
|
||||
=== Get Job API
|
||||
|
||||
The Get Job API provides the ability to get {ml} jobs in the cluster.
|
||||
It accepts a `GetJobRequest` object and responds
|
||||
with a `GetJobResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-job-request]]
|
||||
==== Get Job Request
|
||||
|
||||
A `GetJobRequest` object gets can have any number of `jobId` or `groupName`
|
||||
entries. However, they all must be non-null. An empty list is the same as
|
||||
requesting for all jobs.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-job-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-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-execute]
|
||||
--------------------------------------------------
|
||||
<1> `getCount()` from the `GetJobResponse` indicates the number of jobs found
|
||||
<2> `getJobs()` is the collection of {ml} `Job` objects found
|
||||
|
||||
[[java-rest-high-x-pack-ml-get-job-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-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `GetJobRequest` 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 `GetJobResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-get-job-listener]
|
||||
--------------------------------------------------
|
||||
<1> `onResponse` is called back when the action is completed successfully
|
||||
<2> `onFailure` is called back when some unexpected error occurs
|
|
@ -205,11 +205,13 @@ include::licensing/delete-license.asciidoc[]
|
|||
The Java High Level REST Client supports the following Machine Learning APIs:
|
||||
|
||||
* <<java-rest-high-x-pack-ml-put-job>>
|
||||
* <<java-rest-high-x-pack-ml-get-job>>
|
||||
* <<java-rest-high-x-pack-ml-delete-job>>
|
||||
* <<java-rest-high-x-pack-ml-open-job>>
|
||||
* <<java-rest-high-x-pack-ml-close-job>>
|
||||
|
||||
include::ml/put-job.asciidoc[]
|
||||
include::ml/get-job.asciidoc[]
|
||||
include::ml/delete-job.asciidoc[]
|
||||
include::ml/open-job.asciidoc[]
|
||||
include::ml/close-job.asciidoc[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue