2017-11-23 14:52:37 -05:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2017-11-23 14:52:37 -05:00
|
|
|
[[ml-forecast]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Forecast jobs API
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Forecast jobs</titleabbrev>
|
2017-12-14 13:52:49 -05:00
|
|
|
++++
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2018-06-21 14:32:11 -04:00
|
|
|
Predicts the future behavior of a time series by using its historical behavior.
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-forecast-request]]
|
|
|
|
==== {api-request-title}
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`POST _ml/anomaly_detectors/<job_id>/_forecast`
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-06-27 16:58:42 -04: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
|
|
|
|
{stack-ov}/security-privileges.html[Security privileges].
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-forecast-desc]]
|
|
|
|
==== {api-description-title}
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
See {stack-ov}/ml-overview.html#ml-forecasting[Forecasting the future].
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2017-11-23 18:53:21 -05:00
|
|
|
[NOTE]
|
|
|
|
===============================
|
|
|
|
|
|
|
|
* If you use an `over_field_name` property in your job, you cannot create a
|
2017-11-23 14:52:37 -05:00
|
|
|
forecast. For more information about this property, see <<ml-job-resource>>.
|
2017-11-23 18:53:21 -05:00
|
|
|
* The job must be open when you create a forecast. Otherwise, an error occurs.
|
|
|
|
===============================
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-forecast-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<job_id>`::
|
|
|
|
(Required, string) Identifier for the job.
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-forecast-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`duration`::
|
|
|
|
(Optional, 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
|
2017-12-21 11:14:52 -05:00
|
|
|
day. The forecast starts at the last record that was processed. For more
|
|
|
|
information about time units, see <<time-units>>.
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`expires_in`::
|
|
|
|
(Optional, time units) The period of time that forecast results are retained.
|
2017-11-28 05:49:15 -05: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.
|
|
|
|
For more information about time units, see <<time-units>>.
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-forecast-example]]
|
|
|
|
==== {api-examples-title}
|
2017-11-23 14:52:37 -05:00
|
|
|
|
|
|
|
The following example requests a 10 day forecast for the `total-requests` job:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
POST _ml/anomaly_detectors/total-requests/_forecast
|
2017-11-23 14:52:37 -05:00
|
|
|
{
|
|
|
|
"duration": "10d"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
2018-06-21 14:32:11 -04:00
|
|
|
// TEST[skip:requires delay]
|
2017-11-23 14:52:37 -05:00
|
|
|
|
|
|
|
When the forecast is created, you receive the following results:
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"acknowledged": true,
|
2018-04-19 10:01:17 -04:00
|
|
|
"forecast_id": "wkCWa2IB2lF8nSE_TzZo"
|
2017-11-23 14:52:37 -05:00
|
|
|
}
|
|
|
|
----
|
2018-06-21 14:32:11 -04:00
|
|
|
// NOTCONSOLE
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2017-12-21 11:14:52 -05:00
|
|
|
You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.
|
2018-06-21 14:32:11 -04:00
|
|
|
|