2017-04-11 21:52:47 -04:00
//lcawley: Verified example output 2017-04-11
2017-04-04 18:26:39 -04:00
[[ml-flush-job]]
==== Flush Jobs
2017-04-11 21:52:47 -04:00
The flush job API forces any buffered data to be processed by the job.
2017-04-04 18:26:39 -04:00
===== Request
2017-04-11 21:52:47 -04:00
2017-04-04 18:26:39 -04:00
`POST _xpack/ml/anomaly_detectors/<job_id>/_flush`
===== Description
2017-04-11 21:52:47 -04:00
The flush job API is only applicable when sending data for analysis using the <<ml-post-data,post data API>>. Depending on the content of the buffer, then it might additionally calculate new results.
2017-04-04 18:26:39 -04:00
2017-04-18 18:13:21 -04:00
Both flush and close operations are similar, however the flush is more efficient
if you are expecting to send more data for analysis.
2017-04-04 18:26:39 -04:00
When flushing, the job remains open and is available to continue analyzing data.
2017-04-18 18:13:21 -04:00
A close operation additionally prunes and persists the model state to disk
and the job must be opened again before analyzing further data.
You must have `manage_ml`, or `manage` cluster privileges to use this API.
For more information, see <<privileges-list-cluster>>.
2017-04-04 18:26:39 -04:00
===== Path Parameters
`job_id` (required)::
2017-04-11 22:26:18 -04:00
(string) Identifier for the job
2017-04-04 18:26:39 -04:00
===== Query Parameters
2017-04-11 21:52:47 -04:00
`advance_time`::
2017-04-11 22:26:18 -04:00
(string) Specifies that no data prior to the date `advance_time` is expected.
2017-04-04 18:26:39 -04:00
`end`::
2017-04-11 22:26:18 -04:00
(string) When used in conjunction with `calc_interim`, specifies the range
2017-04-11 21:52:47 -04:00
of buckets on which to calculate interim results.
2017-04-04 18:26:39 -04:00
2017-04-11 21:52:47 -04:00
`calc_interim`::
2017-04-11 22:26:18 -04:00
(boolean) If true, calculates the interim results for the most recent bucket
2017-04-11 21:52:47 -04:00
or all buckets within the latency period.
2017-04-04 18:26:39 -04:00
2017-04-11 21:52:47 -04:00
`start`::
2017-04-11 22:26:18 -04:00
(string) When used in conjunction with `calc_interim`, specifies the range of
2017-04-11 21:52:47 -04:00
buckets on which to calculate interim results.
2017-04-04 18:26:39 -04:00
////
===== Responses
200
(EmptyResponse) The cluster has been successfully deleted
404
(BasicFailedReply) The cluster specified by {cluster_id} cannot be found (code: clusters.cluster_not_found)
412
(BasicFailedReply) The Elasticsearch cluster has not been shutdown yet (code: clusters.cluster_plan_state_error)
////
2017-04-06 10:56:46 -04:00
===== Examples
2017-04-11 21:52:47 -04:00
The following example flushes the `farequote` job:
2017-04-06 10:56:46 -04:00
[source,js]
--------------------------------------------------
POST _xpack/ml/anomaly_detectors/farequote/_flush
{
"calc_interim": true
}
--------------------------------------------------
// CONSOLE
// TEST[skip:todo]
When the operation succeeds, you receive the following results:
2017-04-21 11:23:27 -04:00
[source,js]
2017-04-06 10:56:46 -04:00
----
{
"flushed": true
}
----