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
|
2019-10-07 18:23:19 -04:00
|
|
|
<<security-privileges>>.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-forecast-desc]]
|
|
|
|
==== {api-description-title}
|
2017-11-23 14:52:37 -05:00
|
|
|
|
2020-05-25 03:09:47 -04:00
|
|
|
You can create a forecast job based on an {anomaly-job} to extrapolate future
|
|
|
|
behavior. Refer to
|
|
|
|
{ml-docs}/ml-overview.html#ml-forecasting[Forecasting the future] and
|
|
|
|
{ml-docs}/ml-limitations.html#ml-forecast-limitations[forecast limitations] to
|
|
|
|
learn more.
|
|
|
|
|
|
|
|
You can delete a forecast by using the
|
|
|
|
<<ml-delete-forecast,Delete forecast API>>.
|
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
|
2019-12-27 16:30:26 -05:00
|
|
|
forecast. For more information about this property, see <<ml-put-job>>.
|
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>`::
|
2019-12-27 16:30:26 -05:00
|
|
|
(Required, string)
|
2020-06-01 16:46:15 -04:00
|
|
|
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
|
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`::
|
2019-08-08 07:43:55 -04: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-23 14:52:37 -05:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`expires_in`::
|
2020-05-25 03:09:47 -04:00
|
|
|
(Optional, <<time-units, time units>>) The period of time that forecast
|
|
|
|
results are retained. 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.
|
|
|
|
|
2020-05-29 11:16:08 -04:00
|
|
|
`max_model_memory`::
|
|
|
|
(Optional, <<byte-units,byte value>>) The maximum memory the forecast can use.
|
|
|
|
If the forecast needs to use more than the provided amount, it will spool to
|
|
|
|
disk. Default is 20mb, maximum is 500mb and minimum is 1mb. If set to 40% or
|
|
|
|
more of the job's configured memory limit, it is automatically reduced to
|
|
|
|
below that amount.
|
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
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2017-11-23 14:52:37 -05:00
|
|
|
--------------------------------------------------
|
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"
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
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
|
|
|
|