From 530b709948365d7a906b2f87fc2046f265743328 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 19 Feb 2018 11:04:12 -0800 Subject: [PATCH] [DOCS] Add skip_time to Flush Jobs API (elastic/x-pack-elasticsearch#1955) Original commit: elastic/x-pack-elasticsearch@352bd336d8063d18ae7ef5c552f9df9aaec5eaf9 --- docs/build.gradle | 1 - docs/en/rest-api/ml/flush-job.asciidoc | 52 +++++++++++++++++++++----- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/docs/build.gradle b/docs/build.gradle index 3d46fbf5c1b..78d93ad906f 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -65,7 +65,6 @@ buildRestTests.expectedUnconvertedCandidates = [ 'en/watcher/troubleshooting.asciidoc', 'en/ml/api-quickref.asciidoc', 'en/rest-api/ml/delete-snapshot.asciidoc', - 'en/rest-api/ml/flush-job.asciidoc', 'en/rest-api/ml/forecast.asciidoc', 'en/rest-api/ml/get-bucket.asciidoc', 'en/rest-api/ml/get-overall-buckets.asciidoc', diff --git a/docs/en/rest-api/ml/flush-job.asciidoc b/docs/en/rest-api/ml/flush-job.asciidoc index b67a0615af9..2a65c5284fc 100644 --- a/docs/en/rest-api/ml/flush-job.asciidoc +++ b/docs/en/rest-api/ml/flush-job.asciidoc @@ -35,15 +35,21 @@ opened again before analyzing further data. ==== Query Parameters `advance_time`:: - (string) Specifies that no data prior to the date `advance_time` is expected. + (string) Specifies to advance to a particular time value. Results are + generated and the model is updated for data from the specified time interval. + +`calc_interim`:: + (boolean) If true, calculates the interim results for the most recent bucket + or all buckets within the latency period. `end`:: (string) When used in conjunction with `calc_interim`, specifies the range of buckets on which to calculate interim results. -`calc_interim`:: - (boolean) If true, calculates the interim results for the most recent bucket - or all buckets within the latency period. +`skip_time`:: + (string) Specifies to skip to a particular time value. Results are not + generated and the model is not updated for data from the specified time + interval. `start`:: (string) When used in conjunction with `calc_interim`, specifies the range of @@ -54,27 +60,55 @@ opened again before analyzing further data. You must have `manage_ml`, or `manage` cluster privileges to use this API. For more information, see {xpack-ref}/security-privileges.html[Security Privileges]. -//<>. ==== Examples -The following example flushes the `farequote` job: +The following example flushes the `total-requests` job: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/farequote/_flush +POST _xpack/ml/anomaly_detectors/total-requests/_flush { "calc_interim": true } -------------------------------------------------- // CONSOLE -// TEST[skip:todo] +// TEST[setup:server_metrics_openjob] When the operation succeeds, you receive the following results: [source,js] ---- { - "flushed": true + "flushed": true, + "last_finalized_bucket_end": 1455234900000 } ---- +// TESTRESPONSE[s/"last_finalized_bucket_end": 1455234900000/"last_finalized_bucket_end": $body.last_finalized_bucket_end/] + +The `last_finalized_bucket_end` provides the timestamp (in +milliseconds-since-the-epoch) of the end of the last bucket that was processed. + +If you want to flush the job to a specific timestamp, you can use the +`advance_time` or `skip_time` parameters. For example, to advance to 11 AM GMT +on January 1, 2018: + +[source,js] +-------------------------------------------------- +POST _xpack/ml/anomaly_detectors/total-requests/_flush +{ + "advance_time": "1514804400" +} +-------------------------------------------------- +// CONSOLE +// TEST[setup:server_metrics_openjob] + +When the operation succeeds, you receive the following results: +[source,js] +---- +{ + "flushed": true, + "last_finalized_bucket_end": 1514804400000 +} +---- +// TESTRESPONSE