mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-29 01:44:36 -04:00
* Remove `es-test-dir` book-scoped variable * Remove `plugins-examples-dir` book-scoped variable * Remove `:dependencies-dir:` and `:xes-repo-dir:` book-scoped variables - In `index.asciidoc`, two variables (`:dependencies-dir:` and `:xes-repo-dir:`) were removed. - In `sql/index.asciidoc`, the `:sql-tests:` path was updated to fuller path - In `esql/index.asciidoc`, the `:esql-tests:` path was updated idem * Replace `es-repo-dir` with `es-ref-dir` * Move `:include-xpack: true` to few files that use it, remove from index.asciidoc
100 lines
2.9 KiB
Text
100 lines
2.9 KiB
Text
[role="xpack"]
|
|
[[ml-forecast]]
|
|
= Forecast jobs API
|
|
++++
|
|
<titleabbrev>Forecast jobs</titleabbrev>
|
|
++++
|
|
|
|
Predicts the future behavior of a time series by using its historical behavior.
|
|
|
|
[[ml-forecast-request]]
|
|
== {api-request-title}
|
|
|
|
`POST _ml/anomaly_detectors/<job_id>/_forecast`
|
|
|
|
[[ml-forecast-prereqs]]
|
|
== {api-prereq-title}
|
|
|
|
Requires the `manage_ml` cluster privilege. This privilege is included in the
|
|
`machine_learning_admin` built-in role.
|
|
|
|
[[ml-forecast-desc]]
|
|
== {api-description-title}
|
|
|
|
You can create a forecast job based on an {anomaly-job} to extrapolate future
|
|
behavior. Refer to
|
|
{ml-docs}/ml-ad-forecast.html[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>>.
|
|
|
|
[NOTE]
|
|
===============================
|
|
|
|
* Forecasts are not supported for jobs that perform population analysis; an
|
|
error occurs if you try to create a forecast for a job that has an
|
|
`over_field_name` property in its configuration.
|
|
* The job must be open when you create a forecast. Otherwise, an error occurs.
|
|
===============================
|
|
|
|
[[ml-forecast-path-parms]]
|
|
== {api-path-parms-title}
|
|
|
|
`<job_id>`::
|
|
(Required, string)
|
|
include::{es-ref-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
|
|
|
|
[[ml-forecast-query-parms]]
|
|
== {api-query-parms-title}
|
|
|
|
`duration`::
|
|
(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.
|
|
|
|
`expires_in`::
|
|
(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.
|
|
|
|
`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.
|
|
|
|
[[ml-forecast-request-body]]
|
|
== {api-request-body-title}
|
|
|
|
You can also specify the query parameters (such as `duration` and
|
|
`expires_in`) in the request body.
|
|
|
|
[[ml-forecast-example]]
|
|
== {api-examples-title}
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
POST _ml/anomaly_detectors/low_request_rate/_forecast
|
|
{
|
|
"duration": "10d"
|
|
}
|
|
--------------------------------------------------
|
|
// TEST[skip:requires delay]
|
|
|
|
When the forecast is created, you receive the following results:
|
|
[source,js]
|
|
----
|
|
{
|
|
"acknowledged": true,
|
|
"forecast_id": "wkCWa2IB2lF8nSE_TzZo"
|
|
}
|
|
----
|
|
// NOTCONSOLE
|
|
|
|
You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.
|