forecast.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. [role="xpack"]
  2. [[ml-forecast]]
  3. = Forecast jobs API
  4. ++++
  5. <titleabbrev>Forecast jobs</titleabbrev>
  6. ++++
  7. Predicts the future behavior of a time series by using its historical behavior.
  8. [[ml-forecast-request]]
  9. == {api-request-title}
  10. `POST _ml/anomaly_detectors/<job_id>/_forecast`
  11. [[ml-forecast-prereqs]]
  12. == {api-prereq-title}
  13. Requires the `manage_ml` cluster privilege. This privilege is included in the
  14. `machine_learning_admin` built-in role.
  15. [[ml-forecast-desc]]
  16. == {api-description-title}
  17. You can create a forecast job based on an {anomaly-job} to extrapolate future
  18. behavior. Refer to
  19. {ml-docs}/ml-ad-forecast.html[Forecasting the future]
  20. 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. * Forecasts are not supported for jobs that perform population analysis; an
  28. error occurs if you try to create a forecast for a job that has an
  29. `over_field_name` property in its configuration.
  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-query-parms]]
  38. == {api-query-parms-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-request-body]]
  56. == {api-request-body-title}
  57. You can also specify the query parameters (such as `duration` and
  58. `expires_in`) in the request body.
  59. [[ml-forecast-example]]
  60. == {api-examples-title}
  61. [source,console]
  62. --------------------------------------------------
  63. POST _ml/anomaly_detectors/low_request_rate/_forecast
  64. {
  65. "duration": "10d"
  66. }
  67. --------------------------------------------------
  68. // TEST[skip:requires delay]
  69. When the forecast is created, you receive the following results:
  70. [source,js]
  71. ----
  72. {
  73. "acknowledged": true,
  74. "forecast_id": "wkCWa2IB2lF8nSE_TzZo"
  75. }
  76. ----
  77. // NOTCONSOLE
  78. You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.