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
|
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-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
|
2019-12-20 13:01:19 -05:00
|
|
|
{ml-docs}/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>`::
|
2020-01-02 14:23:26 -05:00
|
|
|
(Optional, string) A comma-separated list of forecast identifiers. 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>`::
|
2020-01-02 14:23: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]
|
|
|
|
|
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
|
|
|
|
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:
|
2019-09-06 16:09:09 -04:00
|
|
|
|
2018-09-06 12:20:42 -04:00
|
|
|
[source,js]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
"acknowledged": true
|
|
|
|
}
|
|
|
|
----
|
|
|
|
// NOTCONSOLE
|