forecast.asciidoc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. ==== Request
  10. `POST _ml/anomaly_detectors/<job_id>/_forecast`
  11. ==== Description
  12. See {xpack-ref}/ml-overview.html#ml-forecasting[Forecasting the Future].
  13. [NOTE]
  14. ===============================
  15. * If you use an `over_field_name` property in your job, you cannot create a
  16. forecast. For more information about this property, see <<ml-job-resource>>.
  17. * The job must be open when you create a forecast. Otherwise, an error occurs.
  18. ===============================
  19. ==== Path Parameters
  20. `job_id`::
  21. (string) Identifier for the job.
  22. ==== Request Parameters
  23. `duration`::
  24. (time units) A period of time that indicates how far into the future to
  25. forecast. For example, `30d` corresponds to 30 days. The default value is 1
  26. day. The forecast starts at the last record that was processed. For more
  27. information about time units, see <<time-units>>.
  28. `expires_in`::
  29. (time units) The period of time that forecast results are retained.
  30. After a forecast expires, the results are deleted. The default value is 14 days.
  31. If set to a value of `0`, the forecast is never automatically deleted.
  32. For more information about time units, see <<time-units>>.
  33. ==== Authorization
  34. You must have `manage_ml`, or `manage` cluster privileges to use this API.
  35. For more information, see {xpack-ref}/security-privileges.html[Security Privileges].
  36. ==== Examples
  37. The following example requests a 10 day forecast for the `total-requests` job:
  38. [source,js]
  39. --------------------------------------------------
  40. POST _ml/anomaly_detectors/total-requests/_forecast
  41. {
  42. "duration": "10d"
  43. }
  44. --------------------------------------------------
  45. // CONSOLE
  46. // TEST[skip:requires delay]
  47. When the forecast is created, you receive the following results:
  48. [source,js]
  49. ----
  50. {
  51. "acknowledged": true,
  52. "forecast_id": "wkCWa2IB2lF8nSE_TzZo"
  53. }
  54. ----
  55. // NOTCONSOLE
  56. You can subsequently see the forecast in the *Single Metric Viewer* in {kib}.