2017-11-24 03:52:37 +08:00
|
|
|
[role="xpack"]
|
2018-09-01 07:49:24 +08:00
|
|
|
[testenv="platinum"]
|
2017-11-24 03:52:37 +08:00
|
|
|
[[ml-forecast]]
|
2018-12-21 02:23:28 +08:00
|
|
|
=== Forecast jobs API
|
2017-12-15 02:52:49 +08:00
|
|
|
++++
|
2018-12-21 02:23:28 +08:00
|
|
|
<titleabbrev>Forecast jobs</titleabbrev>
|
2017-12-15 02:52:49 +08:00
|
|
|
++++
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2018-06-22 02:32:11 +08:00
|
|
|
Predicts the future behavior of a time series by using its historical behavior.
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-request]]
|
|
|
|
==== {api-request-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2018-12-08 04:34:11 +08:00
|
|
|
`POST _ml/anomaly_detectors/<job_id>/_forecast`
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-06-28 04:58:42 +08:00
|
|
|
[[ml-forecast-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have `manage_ml` or
|
|
|
|
`manage` cluster privileges to use this API. See
|
2019-10-05 07:10:26 +08:00
|
|
|
<<security-privileges>>.
|
2019-06-28 04:58:42 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-desc]]
|
|
|
|
==== {api-description-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-12-20 06:47:28 +08:00
|
|
|
See {ml-docs}/ml-overview.html#ml-forecasting[Forecasting the future].
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2017-11-24 07:53:21 +08:00
|
|
|
[NOTE]
|
|
|
|
===============================
|
|
|
|
|
|
|
|
* If you use an `over_field_name` property in your job, you cannot create a
|
2019-12-07 07:32:07 +08:00
|
|
|
forecast. For more information about this property, see <<ml-put-job>>.
|
2017-11-24 07:53:21 +08:00
|
|
|
* The job must be open when you create a forecast. Otherwise, an error occurs.
|
|
|
|
===============================
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-07-12 23:26:31 +08:00
|
|
|
`<job_id>`::
|
2019-12-07 07:32:07 +08:00
|
|
|
(Required, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-07-12 23:26:31 +08:00
|
|
|
`duration`::
|
2019-08-08 19:43:55 +08:00
|
|
|
(Optional, <<time-units, time units>>) A period of time that indicates how far
|
|
|
|
into the future to forecast. For example, `30d` corresponds to 30 days. The
|
|
|
|
default value is 1 day. The forecast starts at the last record that was
|
|
|
|
processed.
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-07-12 23:26:31 +08:00
|
|
|
`expires_in`::
|
2019-08-08 19:43:55 +08:00
|
|
|
(Optional, <<time-units, time units>>) The period of time that forecast results are retained.
|
2017-11-28 18:49:15 +08:00
|
|
|
After a forecast expires, the results are deleted. The default value is 14 days.
|
|
|
|
If set to a value of `0`, the forecast is never automatically deleted.
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-example]]
|
|
|
|
==== {api-examples-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
|
|
|
The following example requests a 10 day forecast for the `total-requests` job:
|
|
|
|
|
2019-09-06 22:55:16 +08:00
|
|
|
[source,console]
|
2017-11-24 03:52:37 +08:00
|
|
|
--------------------------------------------------
|
2018-12-08 04:34:11 +08:00
|
|
|
POST _ml/anomaly_detectors/total-requests/_forecast
|
2017-11-24 03:52:37 +08:00
|
|
|
{
|
|
|
|
"duration": "10d"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-06-22 02:32:11 +08:00
|
|
|
// TEST[skip:requires delay]
|
2017-11-24 03:52:37 +08:00
|
|
|
|
|
|
|
When the forecast is created, you receive the following results:
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"acknowledged": true,
|
2018-04-19 22:01:17 +08:00
|
|
|
"forecast_id": "wkCWa2IB2lF8nSE_TzZo"
|
2017-11-24 03:52:37 +08:00
|
|
|
}
|
|
|
|
----
|
2018-06-22 02:32:11 +08:00
|
|
|
// NOTCONSOLE
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2017-12-22 00:14:52 +08:00
|
|
|
You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.
|
2018-06-22 02:32:11 +08:00
|
|
|
|