2018-09-06 12:20:42 -04:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="platinum"]
|
|
|
|
[[ml-delete-forecast]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Delete forecast API
|
2018-09-06 12:20:42 -04:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Delete forecast</titleabbrev>
|
2018-09-06 12:20:42 -04:00
|
|
|
++++
|
|
|
|
|
|
|
|
Deletes forecasts from a {ml} job.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-forecast-request]]
|
|
|
|
==== {api-request-title}
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`DELETE _ml/anomaly_detectors/<job_id>/_forecast` +
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`DELETE _ml/anomaly_detectors/<job_id>/_forecast/<forecast_id>` +
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`DELETE _ml/anomaly_detectors/<job_id>/_forecast/_all`
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-delete-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-delete-forecast-desc]]
|
|
|
|
==== {api-description-title}
|
2018-09-06 12:20:42 -04:00
|
|
|
|
|
|
|
By default, forecasts are retained for 14 days. You can specify a different
|
2019-06-27 16:58:42 -04:00
|
|
|
retention period with the `expires_in` parameter in the
|
|
|
|
<<ml-forecast,forecast jobs API>>. The delete forecast API enables you to delete
|
|
|
|
one or more forecasts before they expire.
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
NOTE: When you delete a job, its associated forecasts are deleted.
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
For more information, see
|
|
|
|
{stack-ov}/ml-overview.html#ml-forecasting[Forecasting the future].
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-forecast-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<forecast_id>`::
|
|
|
|
(Optional, string) A comma-separated list of forecast identifiers.
|
2018-09-06 12:20:42 -04:00
|
|
|
If you do not specify this optional parameter or if you specify `_all`, the
|
|
|
|
API deletes all forecasts from the job.
|
2019-07-12 11:26:31 -04:00
|
|
|
|
|
|
|
`<job_id>`::
|
|
|
|
(Required, string) Required. Identifier for the job.
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-delete-forecast-query-parms]]
|
|
|
|
==== {api-query-parms-title}
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`allow_no_forecasts`::
|
|
|
|
(Optional, boolean) Specifies whether an error occurs when there are no
|
|
|
|
forecasts. In particular, if this parameter is set to `false` and there are no
|
|
|
|
forecasts associated with the job, attempts to delete all forecasts return an
|
|
|
|
error. The default value is `true`.
|
|
|
|
|
|
|
|
`timeout`::
|
2019-08-08 07:43:55 -04:00
|
|
|
(Optional, <<time-units, time units>>) Specifies the period of time to wait
|
|
|
|
for the completion of the delete operation. When this period of time elapses,
|
|
|
|
the API fails and returns an error. The default value is `30s`.
|
2018-09-06 12:20:42 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-delete-forecast-example]]
|
|
|
|
==== {api-examples-title}
|
2018-09-06 12:20:42 -04:00
|
|
|
|
|
|
|
The following example deletes all forecasts from the `total-requests` job:
|
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-09-06 12:20:42 -04:00
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
DELETE _ml/anomaly_detectors/total-requests/_forecast/_all
|
2018-09-06 12:20:42 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:setup:server_metrics_openjob]
|
|
|
|
|
|
|
|
If the request does not encounter errors, you receive the following result:
|
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"acknowledged": true
|
|
|
|
}
|
|
|
|
----
|
|
|
|
// NOTCONSOLE
|