delete-forecast.asciidoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. [[ml-delete-forecast-request]]
  10. ==== {api-request-title}
  11. `DELETE _ml/anomaly_detectors/<job_id>/_forecast` +
  12. `DELETE _ml/anomaly_detectors/<job_id>/_forecast/<forecast_id>` +
  13. `DELETE _ml/anomaly_detectors/<job_id>/_forecast/_all`
  14. [[ml-delete-forecast-prereqs]]
  15. ==== {api-prereq-title}
  16. * If the {es} {security-features} are enabled, you must have `manage_ml` or
  17. `manage` cluster privileges to use this API. See
  18. <<security-privileges>>.
  19. [[ml-delete-forecast-desc]]
  20. ==== {api-description-title}
  21. By default, forecasts are retained for 14 days. You can specify a different
  22. retention period with the `expires_in` parameter in the
  23. <<ml-forecast,forecast jobs API>>. The delete forecast API enables you to delete
  24. one or more forecasts before they expire.
  25. NOTE: When you delete a job, its associated forecasts are deleted.
  26. For more information, see
  27. {stack-ov}/ml-overview.html#ml-forecasting[Forecasting the future].
  28. [[ml-delete-forecast-path-parms]]
  29. ==== {api-path-parms-title}
  30. `<forecast_id>`::
  31. (Optional, string) A comma-separated list of forecast identifiers.
  32. If you do not specify this optional parameter or if you specify `_all`, the
  33. API deletes all forecasts from the job.
  34. `<job_id>`::
  35. (Required, string) Required. Identifier for the job.
  36. [[ml-delete-forecast-query-parms]]
  37. ==== {api-query-parms-title}
  38. `allow_no_forecasts`::
  39. (Optional, boolean) Specifies whether an error occurs when there are no
  40. forecasts. In particular, if this parameter is set to `false` and there are no
  41. forecasts associated with the job, attempts to delete all forecasts return an
  42. error. The default value is `true`.
  43. `timeout`::
  44. (Optional, <<time-units, time units>>) Specifies the period of time to wait
  45. for the completion of the delete operation. When this period of time elapses,
  46. the API fails and returns an error. The default value is `30s`.
  47. [[ml-delete-forecast-example]]
  48. ==== {api-examples-title}
  49. The following example deletes all forecasts from the `total-requests` job:
  50. [source,console]
  51. --------------------------------------------------
  52. DELETE _ml/anomaly_detectors/total-requests/_forecast/_all
  53. --------------------------------------------------
  54. // TEST[skip:setup:server_metrics_openjob]
  55. If the request does not encounter errors, you receive the following result:
  56. [source,js]
  57. ----
  58. {
  59. "acknowledged": true
  60. }
  61. ----
  62. // NOTCONSOLE