mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
HLRC: adding machine learning open job (#32860)
* HLRC: adding machine learning open job HLRC: adding ML open job API call * Addressing @droberts195 comments and fixing minor style issue
This commit is contained in:
parent
5ba04e23fc
commit
f90f06ede1
13 changed files with 495 additions and 4 deletions
55
docs/java-rest/high-level/ml/open-job.asciidoc
Normal file
55
docs/java-rest/high-level/ml/open-job.asciidoc
Normal file
|
@ -0,0 +1,55 @@
|
|||
[[java-rest-high-x-pack-ml-open-job]]
|
||||
=== Open Job API
|
||||
|
||||
The Open Job API provides the ability to open {ml} jobs in the cluster.
|
||||
It accepts a `OpenJobRequest` object and responds
|
||||
with a `OpenJobResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-open-job-request]]
|
||||
==== Open Job Request
|
||||
|
||||
An `OpenJobRequest` object gets created with an existing non-null `jobId`.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-request]
|
||||
--------------------------------------------------
|
||||
<1> Constructing a new request referencing an existing `jobId`
|
||||
<2> Optionally setting the `timeout` value for how long the
|
||||
execution should wait for the job to be opened.
|
||||
|
||||
[[java-rest-high-x-pack-ml-open-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-open-job-execute]
|
||||
--------------------------------------------------
|
||||
<1> `isOpened()` from the `OpenJobResponse` indicates if the job was successfully
|
||||
opened or not.
|
||||
|
||||
[[java-rest-high-x-pack-ml-open-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-open-job-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `OpenJobRequest` 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 `ActionListner` for `OpenJobResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-open-job-listener]
|
||||
--------------------------------------------------
|
||||
<1> `onResponse` is called back when the action is completed successfully
|
||||
<2> `onFailure` is called back when some unexpected error occurs
|
|
@ -205,8 +205,10 @@ 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-open-job>>
|
||||
|
||||
include::ml/put_job.asciidoc[]
|
||||
include::ml/put-job.asciidoc[]
|
||||
include::ml/open-job.asciidoc[]
|
||||
|
||||
== Migration APIs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue