forecast.asciidoc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. Requires the `manage_ml` cluster privilege. This privilege is included in the
  15. `machine_learning_admin` built-in role.
  16. [[ml-forecast-desc]]
  17. == {api-description-title}
  18. You can create a forecast job based on an {anomaly-job} to extrapolate future
  19. behavior. Refer to
  20. {ml-docs}/ml-overview.html#ml-forecasting[Forecasting the future] and
  21. {ml-docs}/ml-limitations.html#ml-forecast-limitations[forecast limitations] to
  22. learn more.
  23. You can delete a forecast by using the
  24. <<ml-delete-forecast,Delete forecast API>>.
  25. [NOTE]
  26. ===============================
  27. * If you use an `over_field_name` property in your job, you cannot create a
  28. forecast. For more information about this property, see <<ml-put-job>>.
  29. * The job must be open when you create a forecast. Otherwise, an error occurs.
  30. ===============================
  31. [[ml-forecast-path-parms]]
  32. == {api-path-parms-title}
  33. `<job_id>`::
  34. (Required, string)
  35. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  36. [[ml-forecast-request-body]]
  37. == {api-request-body-title}
  38. `duration`::
  39. (Optional, <<time-units, time units>>) A period of time that indicates how far
  40. into the future to forecast. For example, `30d` corresponds to 30 days. The
  41. default value is 1 day. The forecast starts at the last record that was
  42. processed.
  43. `expires_in`::
  44. (Optional, <<time-units, time units>>) The period of time that forecast
  45. results are retained. After a forecast expires, the results are deleted. The
  46. default value is 14 days. If set to a value of `0`, the forecast is never
  47. automatically deleted.
  48. `max_model_memory`::
  49. (Optional, <<byte-units,byte value>>) The maximum memory the forecast can use.
  50. If the forecast needs to use more than the provided amount, it will spool to
  51. disk. Default is 20mb, maximum is 500mb and minimum is 1mb. If set to 40% or
  52. more of the job's configured memory limit, it is automatically reduced to
  53. below that amount.
  54. [[ml-forecast-example]]
  55. == {api-examples-title}
  56. [source,console]
  57. --------------------------------------------------
  58. POST _ml/anomaly_detectors/low_request_rate/_forecast
  59. {
  60. "duration": "10d"
  61. }
  62. --------------------------------------------------
  63. // TEST[skip:requires delay]
  64. When the forecast is created, you receive the following results:
  65. [source,js]
  66. ----
  67. {
  68. "acknowledged": true,
  69. "forecast_id": "wkCWa2IB2lF8nSE_TzZo"
  70. }
  71. ----
  72. // NOTCONSOLE
  73. You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.