start-datafeed.asciidoc 3.8 KB

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