create-data-stream.asciidoc 1.8 KB

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