delete-forecast.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-delete-forecast]]
  4. === Delete Forecast API
  5. ++++
  6. <titleabbrev>Delete Forecast</titleabbrev>
  7. ++++
  8. Deletes forecasts from a {ml} job.
  9. ==== Request
  10. `DELETE _xpack/ml/anomaly_detectors/<job_id>/_forecast` +
  11. `DELETE _xpack/ml/anomaly_detectors/<job_id>/_forecast/<forecast_id>` +
  12. `DELETE _xpack/ml/anomaly_detectors/<job_id>/_forecast/_all`
  13. ==== Description
  14. By default, forecasts are retained for 14 days. You can specify a different
  15. 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.
  16. NOTE: When you delete a job its associated forecasts are deleted.
  17. For more information, see {stack-ov}/ml-overview.html#ml-forecasting[Forecasting the Future].
  18. ==== Path Parameters
  19. `job_id` (required)::
  20. (string) Identifier for the job.
  21. `forecast_id`::
  22. (string) A comma-separated list of forecast identifiers.
  23. If you do not specify this optional parameter or if you specify `_all`, the
  24. API deletes all forecasts from the job.
  25. ==== Request Parameters
  26. `allow_no_forecasts`::
  27. (boolean) Specifies whether an error occurs when there are no forecasts. In
  28. particular, if this parameter is set to `false` and there are no forecasts
  29. associated with the job, attempts to delete all forecasts return an error.
  30. The default value is `true`.
  31. `timeout`::
  32. (time units) Specifies the period of time to wait for the completion of the
  33. delete operation. When this period of time elapses, the API fails and returns
  34. an error. The default value is `30s`. For more information about time units,
  35. see <<time-units>>.
  36. ==== Authorization
  37. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  38. For more information, see {stack-ov}/security-privileges.html[Security Privileges].
  39. ==== Examples
  40. The following example deletes all forecasts from the `total-requests` job:
  41. [source,js]
  42. --------------------------------------------------
  43. DELETE _xpack/ml/anomaly_detectors/total-requests/_forecast/_all
  44. --------------------------------------------------
  45. // CONSOLE
  46. // TEST[skip:setup:server_metrics_openjob]
  47. If the request does not encounter errors, you receive the following result:
  48. [source,js]
  49. ----
  50. {
  51. "acknowledged": true
  52. }
  53. ----
  54. // NOTCONSOLE