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]]
|
2020-07-21 03:38:09 +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]]
|
2020-07-21 03:38:09 +08:00
|
|
|
== {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]]
|
2020-07-21 03:38:09 +08:00
|
|
|
== {api-prereq-title}
|
2019-06-28 04:58:42 +08:00
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have `manage_ml` or
|
|
|
|
`manage` cluster privileges to use this API. See
|
2020-07-24 03:14:56 +08:00
|
|
|
<<security-privileges>> and {ml-docs-setup-privileges}.
|
2019-06-28 04:58:42 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-desc]]
|
2020-07-21 03:38:09 +08:00
|
|
|
== {api-description-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2020-05-25 15:09:47 +08:00
|
|
|
You can create a forecast job based on an {anomaly-job} to extrapolate future
|
2020-07-24 03:14:56 +08:00
|
|
|
behavior. Refer to
|
2020-05-25 15:09:47 +08:00
|
|
|
{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-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]]
|
2020-07-21 03:38:09 +08:00
|
|
|
== {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)
|
2020-06-02 02:46:10 +08:00
|
|
|
include::{es-repo-dir}/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]]
|
2020-07-21 03:38:09 +08:00
|
|
|
== {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`::
|
2020-05-25 15:09:47 +08: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 20:59:50 +08: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-24 03:52:37 +08:00
|
|
|
|
2019-06-28 00:42:47 +08:00
|
|
|
[[ml-forecast-example]]
|
2020-07-21 03:38:09 +08:00
|
|
|
== {api-examples-title}
|
2017-11-24 03:52:37 +08:00
|
|
|
|
2019-09-06 22:55:16 +08:00
|
|
|
[source,console]
|
2017-11-24 03:52:37 +08:00
|
|
|
--------------------------------------------------
|
2019-12-31 07:21:18 +08:00
|
|
|
POST _ml/anomaly_detectors/low_request_rate/_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}.
|