delete-forecast.asciidoc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. {stack-ov}/security-privileges.html[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. `<job_id>` (Required)::
  31. (string) Identifier for the job.
  32. `forecast_id` (Optional)::
  33. (string) A comma-separated list of forecast identifiers.
  34. If you do not specify this optional parameter or if you specify `_all`, the
  35. API deletes all forecasts from the job.
  36. [[ml-delete-forecast-query-parms]]
  37. ==== {api-query-parms-title}
  38. `allow_no_forecasts` (Optional)::
  39. (boolean) Specifies whether an error occurs when there are no forecasts. In
  40. particular, if this parameter is set to `false` and there are no forecasts
  41. associated with the job, attempts to delete all forecasts return an error.
  42. The default value is `true`.
  43. `timeout` (Optional)::
  44. (time units) Specifies the period of time to wait for the completion of the
  45. delete operation. When this period of time elapses, the API fails and returns
  46. an error. The default value is `30s`. For more information about time units,
  47. see <<time-units>>.
  48. [[ml-delete-forecast-example]]
  49. ==== {api-examples-title}
  50. The following example deletes all forecasts from the `total-requests` job:
  51. [source,js]
  52. --------------------------------------------------
  53. DELETE _ml/anomaly_detectors/total-requests/_forecast/_all
  54. --------------------------------------------------
  55. // CONSOLE
  56. // TEST[skip:setup:server_metrics_openjob]
  57. If the request does not encounter errors, you receive the following result:
  58. [source,js]
  59. ----
  60. {
  61. "acknowledged": true
  62. }
  63. ----
  64. // NOTCONSOLE