IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Forecast jobs API
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Forecast jobs API
editPredicts the future behavior of a time series by using its historical behavior.
Request
editPOST _ml/anomaly_detectors/<job_id>/_forecast
Prerequisites
edit-
If the Elasticsearch security features are enabled, you must have
manage_ml
ormanage
cluster privileges to use this API. See Security privileges.
Description
editYou can create a forecast job based on an anomaly detection job to extrapolate future behavior. Refer to Forecasting the future and forecast limitations to learn more.
You can delete a forecast by using the Delete forecast API.
-
If you use an
over_field_name
property in your job, you cannot create a forecast. For more information about this property, see Create jobs. - The job must be open when you create a forecast. Otherwise, an error occurs.
Path parameters
edit-
<job_id>
- (Required, string) Identifier for the anomaly detection job.
Request body
edit-
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 day. The forecast starts at the last record that was processed. -
expires_in
-
(Optional, 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.
Examples
editPOST _ml/anomaly_detectors/total-requests/_forecast { "duration": "10d" }
When the forecast is created, you receive the following results:
{ "acknowledged": true, "forecast_id": "wkCWa2IB2lF8nSE_TzZo" }
You can subsequently see the forecast in the Single Metric Viewer in Kibana.