forecast.asciidoc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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>> and {ml-docs-setup-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::{es-repo-dir}/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. `max_model_memory`::
  50. (Optional, <<byte-units,byte value>>) The maximum memory the forecast can use.
  51. If the forecast needs to use more than the provided amount, it will spool to
  52. disk. Default is 20mb, maximum is 500mb and minimum is 1mb. If set to 40% or
  53. more of the job's configured memory limit, it is automatically reduced to
  54. below that amount.
  55. [[ml-forecast-example]]
  56. == {api-examples-title}
  57. [source,console]
  58. --------------------------------------------------
  59. POST _ml/anomaly_detectors/low_request_rate/_forecast
  60. {
  61. "duration": "10d"
  62. }
  63. --------------------------------------------------
  64. // TEST[skip:requires delay]
  65. When the forecast is created, you receive the following results:
  66. [source,js]
  67. ----
  68. {
  69. "acknowledged": true,
  70. "forecast_id": "wkCWa2IB2lF8nSE_TzZo"
  71. }
  72. ----
  73. // NOTCONSOLE
  74. You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.