create-data-stream.asciidoc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. [[indices-create-data-stream]]
  2. === Create data stream API
  3. ++++
  4. <titleabbrev>Create data stream</titleabbrev>
  5. ++++
  6. Creates a new data stream.
  7. Data streams provide a convenient way to ingest, search, and manage time series
  8. data. Documents containing time series data may be indexed directly into a data
  9. stream and searched through the data stream. Behind the scenes, data streams
  10. contain one or more hidden backing indices and a generation attribute that
  11. indicates which of the backing indices is the write index, the index into which
  12. documents will be ingested.
  13. Backing indices are generated with the naming convention
  14. `<data-stream-name>-zzzzzz` where `zzzzzz` is the six-digit, zero-padded
  15. generation of the data stream. For example, a data stream named
  16. `web-server-logs` with a generation of 34 would have a write index named
  17. `web-server-logs-000034`. While nothing prevents backing indices from being
  18. addressed directly, data streams are integrated with the
  19. <<indices-rollover-index, rollover index API>> and
  20. <<index-lifecycle-management, index lifecycle management (ILM)>> to facilitate
  21. the management of the time series data contained in their backing indices.
  22. A data stream can only be created if the namespace it targets has a component
  23. template exists with a `data_stream` definition.
  24. [source,console]
  25. -----------------------------------
  26. PUT _index_template/template
  27. {
  28. "index_patterns": ["my-data-stream*"],
  29. "data_stream": {
  30. "timestamp_field": "@timestamp"
  31. }
  32. }
  33. -----------------------------------
  34. // TEST
  35. [source,console]
  36. --------------------------------------------------
  37. PUT _data_stream/my-data-stream
  38. --------------------------------------------------
  39. // TEST[continued]
  40. ////
  41. [source,console]
  42. -----------------------------------
  43. DELETE /_data_stream/my-data-stream
  44. DELETE /_index_template/template
  45. -----------------------------------
  46. // TEST[continued]
  47. ////
  48. [[indices-create-data-stream-request]]
  49. ==== {api-request-title}
  50. `PUT _data_stream/<data-stream>`
  51. [[indices-create-data-stream-desc]]
  52. ==== {api-description-title}
  53. You can use the create data stream API to add a new data stream to an {es}
  54. cluster. When creating a data stream, you must specify the following:
  55. * The name of the data stream
  56. * The name of the timestamp field.
  57. [[indices-create-data-stream-api-path-params]]
  58. ==== {api-path-parms-title}
  59. `<data-stream>`::
  60. +
  61. --
  62. (Required, string) Name of the data stream to create.
  63. Data stream names must meet the following criteria:
  64. - Lowercase only
  65. - Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, ` ` (space character),
  66. `,`, `#`, `:`
  67. - Cannot start with `-`, `_`, `+`, `.`
  68. - Cannot be `.` or `..`
  69. - Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters
  70. will count towards the 255 limit faster)
  71. --