start-datafeed.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-start-datafeed]]
  4. === Start {dfeeds} API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Start {dfeeds}</titleabbrev>
  8. ++++
  9. Starts one or more {dfeeds}.
  10. [[ml-start-datafeed-request]]
  11. ==== {api-request-title}
  12. `POST _ml/datafeeds/<feed_id>/_start`
  13. [[ml-start-datafeed-prereqs]]
  14. ==== {api-prereq-title}
  15. * Before you can start a {dfeed}, the job must be open. Otherwise, an error
  16. occurs.
  17. * If {es} {security-features} are enabled, you must have `manage_ml` or `manage`
  18. cluster privileges to use this API. See
  19. {stack-ov}/security-privileges.html[Security privileges].
  20. [[ml-start-datafeed-desc]]
  21. ==== {api-description-title}
  22. A {dfeed} must be started in order to retrieve data from {es}.
  23. A {dfeed} can be started and stopped multiple times throughout its lifecycle.
  24. When you start a {dfeed}, you can specify a start time. This enables you to
  25. include a training period, providing you have this data available in {es}.
  26. If you want to analyze from the beginning of a dataset, you can specify any date
  27. earlier than that beginning date.
  28. If you do not specify a start time and the {dfeed} is associated with a new
  29. job, the analysis starts from the earliest time for which data is available.
  30. When you start a {dfeed}, you can also specify an end time. If you do so, the
  31. job analyzes data from the start time until the end time, at which point the
  32. analysis stops. This scenario is useful for a one-off batch analysis. If you
  33. do not specify an end time, the {dfeed} runs continuously.
  34. The `start` and `end` times can be specified by using one of the
  35. following formats: +
  36. - ISO 8601 format with milliseconds, for example `2017-01-22T06:00:00.000Z`
  37. - ISO 8601 format without milliseconds, for example `2017-01-22T06:00:00+00:00`
  38. - Seconds from the Epoch, for example `1390370400`
  39. Date-time arguments using either of the ISO 8601 formats must have a time zone
  40. designator, where Z is accepted as an abbreviation for UTC time.
  41. NOTE: When a URL is expected (for example, in browsers), the `+` used in time
  42. zone designators must be encoded as `%2B`.
  43. If the system restarts, any jobs that had {dfeeds} running are also restarted.
  44. When a stopped {dfeed} is restarted, it continues processing input data from
  45. the next millisecond after it was stopped. If new data was indexed for that
  46. exact millisecond between stopping and starting, it will be ignored.
  47. If you specify a `start` value that is earlier than the timestamp of the latest
  48. processed record, the {dfeed} continues from 1 millisecond after the timestamp
  49. of the latest processed record.
  50. IMPORTANT: When {es} {security-features} are enabled, your {dfeed} remembers
  51. which roles the last user to create or update it had at the time of
  52. creation/update and runs the query using those same roles.
  53. [[ml-start-datafeed-path-parms]]
  54. ==== {api-path-parms-title}
  55. `<feed_id>`::
  56. (Required, string) Identifier for the {dfeed}.
  57. [[ml-start-datafeed-request-body]]
  58. ==== {api-request-body-title}
  59. `end`::
  60. (Optional, string) The time that the {dfeed} should end. This value is
  61. exclusive. The default value is an empty string.
  62. `start`::
  63. (Optional, string) The time that the {dfeed} should begin. This value is
  64. inclusive. The default value is an empty string.
  65. `timeout`::
  66. (Optional, time) Controls the amount of time to wait until a {dfeed} starts.
  67. The default value is 20 seconds.
  68. [[ml-start-datafeed-example]]
  69. ==== {api-examples-title}
  70. The following example starts the `datafeed-it-ops-kpi` {dfeed}:
  71. [source,js]
  72. --------------------------------------------------
  73. POST _ml/datafeeds/datafeed-total-requests/_start
  74. {
  75. "start": "2017-04-07T18:22:16Z"
  76. }
  77. --------------------------------------------------
  78. // CONSOLE
  79. // TEST[skip:setup:server_metrics_openjob]
  80. When the {dfeed} starts, you receive the following results:
  81. [source,js]
  82. ----
  83. {
  84. "started": true
  85. }
  86. ----
  87. // TESTRESPONSE