create-data-stream.asciidoc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. A data stream can only be created if the namespace it targets has a component
  8. template that exists with a `data_stream` definition.
  9. [source,console]
  10. -----------------------------------
  11. PUT _index_template/template
  12. {
  13. "index_patterns": ["my-data-stream*"],
  14. "data_stream": {
  15. "timestamp_field": "@timestamp"
  16. }
  17. }
  18. -----------------------------------
  19. // TEST
  20. [source,console]
  21. --------------------------------------------------
  22. PUT _data_stream/my-data-stream
  23. --------------------------------------------------
  24. // TEST[continued]
  25. ////
  26. [source,console]
  27. -----------------------------------
  28. DELETE /_data_stream/my-data-stream
  29. DELETE /_index_template/template
  30. -----------------------------------
  31. // TEST[continued]
  32. ////
  33. [[indices-create-data-stream-request]]
  34. ==== {api-request-title}
  35. `PUT _data_stream/<data-stream>`
  36. [[indices-create-data-stream-desc]]
  37. ==== {api-description-title}
  38. You can use the create data stream API to add a new data stream to an {es}
  39. cluster. When creating a data stream, you must specify the following:
  40. * The name of the data stream
  41. * The name of the timestamp field.
  42. [[indices-create-data-stream-api-path-params]]
  43. ==== {api-path-parms-title}
  44. `<data-stream>`::
  45. +
  46. --
  47. (Required, string) Name of the data stream to create.
  48. Data stream names must meet the following criteria:
  49. - Lowercase only
  50. - Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, ` ` (space character),
  51. `,`, `#`, `:`
  52. - Cannot start with `-`, `_`, `+`, `.`
  53. - Cannot be `.` or `..`
  54. - Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters
  55. will count towards the 255 limit faster)
  56. --