mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
HLRC: ML Flush job (#33187)
* HLRC: ML Flush job * Fixing package, paths, and test * Addressing comments
This commit is contained in:
parent
19b14fa5ed
commit
6770a456b8
11 changed files with 668 additions and 0 deletions
83
docs/java-rest/high-level/ml/flush-job.asciidoc
Normal file
83
docs/java-rest/high-level/ml/flush-job.asciidoc
Normal file
|
@ -0,0 +1,83 @@
|
|||
[[java-rest-high-x-pack-ml-flush-job]]
|
||||
=== Flush Job API
|
||||
|
||||
The Flush Job API provides the ability to flush a {ml} job's
|
||||
datafeed in the cluster.
|
||||
It accepts a `FlushJobRequest` object and responds
|
||||
with a `FlushJobResponse` object.
|
||||
|
||||
[[java-rest-high-x-pack-ml-flush-job-request]]
|
||||
==== Flush Job Request
|
||||
|
||||
A `FlushJobRequest` object gets created with an existing non-null `jobId`.
|
||||
All other fields are optional for the request.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-flush-job-request]
|
||||
--------------------------------------------------
|
||||
<1> Constructing a new request referencing an existing `jobId`
|
||||
|
||||
==== Optional Arguments
|
||||
|
||||
The following arguments are optional.
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-flush-job-request-options]
|
||||
--------------------------------------------------
|
||||
<1> Set request to calculate the interim results
|
||||
<2> Set the advanced time to flush to the particular time value
|
||||
<3> Set the start time for the range of buckets on which
|
||||
to calculate the interim results (requires `calc_interim` to be `true`)
|
||||
<4> Set the end time for the range of buckets on which
|
||||
to calculate interim results (requires `calc_interim` to be `true`)
|
||||
<5> Set the skip time to skip a particular time value
|
||||
|
||||
[[java-rest-high-x-pack-ml-flush-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-flush-job-execute]
|
||||
--------------------------------------------------
|
||||
|
||||
[[java-rest-high-x-pack-ml-flush-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-flush-job-execute-async]
|
||||
--------------------------------------------------
|
||||
<1> The `FlushJobRequest` 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 `FlushJobResponse` may
|
||||
look like
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-flush-job-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-flush-job-response]]
|
||||
==== Flush Job Response
|
||||
|
||||
A `FlushJobResponse` contains an acknowledgement and an optional end date for the
|
||||
last finalized bucket
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-flush-job-response]
|
||||
--------------------------------------------------
|
||||
<1> `isFlushed()` indicates if the job was successfully flushed or not.
|
||||
<2> `getLastFinalizedBucketEnd()` provides the timestamp
|
||||
(in milliseconds-since-the-epoch) of the end of the last bucket that was processed.
|
|
@ -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-flush-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>>
|
||||
|
@ -220,6 +221,7 @@ include::ml/get-job.asciidoc[]
|
|||
include::ml/delete-job.asciidoc[]
|
||||
include::ml/open-job.asciidoc[]
|
||||
include::ml/close-job.asciidoc[]
|
||||
include::ml/flush-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