forecast.asciidoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-forecast]]
  4. === Forecast jobs API
  5. ++++
  6. <titleabbrev>Forecast jobs</titleabbrev>
  7. ++++
  8. Predicts the future behavior of a time series by using its historical behavior.
  9. [[ml-forecast-request]]
  10. ==== {api-request-title}
  11. `POST _ml/anomaly_detectors/<job_id>/_forecast`
  12. [[ml-forecast-prereqs]]
  13. ==== {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have `manage_ml` or
  15. `manage` cluster privileges to use this API. See
  16. <<security-privileges>>.
  17. [[ml-forecast-desc]]
  18. ==== {api-description-title}
  19. You can create a forecast job based on an {anomaly-job} to extrapolate future
  20. behavior. Refer to
  21. {ml-docs}/ml-overview.html#ml-forecasting[Forecasting the future] and
  22. {ml-docs}/ml-limitations.html#ml-forecast-limitations[forecast limitations] to
  23. learn more.
  24. You can delete a forecast by using the
  25. <<ml-delete-forecast,Delete forecast API>>.
  26. [NOTE]
  27. ===============================
  28. * If you use an `over_field_name` property in your job, you cannot create a
  29. forecast. For more information about this property, see <<ml-put-job>>.
  30. * The job must be open when you create a forecast. Otherwise, an error occurs.
  31. ===============================
  32. [[ml-forecast-path-parms]]
  33. ==== {api-path-parms-title}
  34. `<job_id>`::
  35. (Required, string)
  36. include::{docdir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  37. [[ml-forecast-request-body]]
  38. ==== {api-request-body-title}
  39. `duration`::
  40. (Optional, <<time-units, time units>>) A period of time that indicates how far
  41. into the future to forecast. For example, `30d` corresponds to 30 days. The
  42. default value is 1 day. The forecast starts at the last record that was
  43. processed.
  44. `expires_in`::
  45. (Optional, <<time-units, time units>>) The period of time that forecast
  46. results are retained. After a forecast expires, the results are deleted. The
  47. default value is 14 days. If set to a value of `0`, the forecast is never
  48. automatically deleted.
  49. [[ml-forecast-example]]
  50. ==== {api-examples-title}
  51. [source,console]
  52. --------------------------------------------------
  53. POST _ml/anomaly_detectors/low_request_rate/_forecast
  54. {
  55. "duration": "10d"
  56. }
  57. --------------------------------------------------
  58. // TEST[skip:requires delay]
  59. When the forecast is created, you receive the following results:
  60. [source,js]
  61. ----
  62. {
  63. "acknowledged": true,
  64. "forecast_id": "wkCWa2IB2lF8nSE_TzZo"
  65. }
  66. ----
  67. // NOTCONSOLE
  68. You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.