1
0

data-streams.asciidoc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [role="xpack"]
  2. [[data-streams]]
  3. = Data streams
  4. ++++
  5. <titleabbrev>Data streams</titleabbrev>
  6. ++++
  7. A data stream lets you store append-only time series
  8. data across multiple indices while giving you a single named resource for
  9. requests. Data streams are well-suited for logs, events, metrics, and other
  10. continuously generated data.
  11. You can submit indexing and search requests directly to a data stream. The
  12. stream automatically routes the request to backing indices that store the
  13. stream's data. You can use <<index-lifecycle-management,{ilm} ({ilm-init})>> to
  14. automate the management of these backing indices. For example, you can use
  15. {ilm-init} to automatically move older backing indices to less expensive
  16. hardware and delete unneeded indices. {ilm-init} can help you reduce costs and
  17. overhead as your data grows.
  18. [discrete]
  19. [[backing-indices]]
  20. == Backing indices
  21. A data stream consists of one or more <<index-hidden,hidden>>, auto-generated
  22. backing indices.
  23. image::images/data-streams/data-streams-diagram.svg[align="center"]
  24. A data stream requires a matching <<index-templates,index template>>. The
  25. template contains the mappings and settings used to configure the stream's
  26. backing indices.
  27. // tag::timestamp-reqs[]
  28. Every document indexed to a data stream must contain a `@timestamp` field,
  29. mapped as a <<date,`date`>> or <<date_nanos,`date_nanos`>> field type. If the
  30. index template doesn't specify a mapping for the `@timestamp` field, {es} maps
  31. `@timestamp` as a `date` field with default options.
  32. // end::timestamp-reqs[]
  33. The same index template can be used for multiple data streams. You cannot
  34. delete an index template in use by a data stream.
  35. The name pattern for the backing indices is an implementation detail and no
  36. intelligence should be derived from it. The only invariant the holds is that
  37. each data stream generation index will have a unique name.
  38. [discrete]
  39. [[data-stream-read-requests]]
  40. == Read requests
  41. When you submit a read request to a data stream, the stream routes the request
  42. to all its backing indices.
  43. image::images/data-streams/data-streams-search-request.svg[align="center"]
  44. [discrete]
  45. [[data-stream-write-index]]
  46. == Write index
  47. The most recently created backing index is the data stream’s write index.
  48. The stream adds new documents to this index only.
  49. image::images/data-streams/data-streams-index-request.svg[align="center"]
  50. You cannot add new documents to other backing indices, even by sending requests
  51. directly to the index.
  52. You also cannot perform operations on a write index that may hinder indexing,
  53. such as:
  54. * <<indices-clone-index,Clone>>
  55. * <<indices-delete-index,Delete>>
  56. * <<indices-shrink-index,Shrink>>
  57. * <<indices-split-index,Split>>
  58. [discrete]
  59. [[data-streams-rollover]]
  60. == Rollover
  61. A <<indices-rollover-index,rollover>> creates a new backing index that becomes
  62. the stream's new write index.
  63. We recommend using <<index-lifecycle-management,{ilm-init}>> to automatically
  64. roll over data streams when the write index reaches a specified age or size.
  65. If needed, you can also <<manually-roll-over-a-data-stream,manually roll over>>
  66. a data stream.
  67. [discrete]
  68. [[data-streams-generation]]
  69. == Generation
  70. Each data stream tracks its generation: a six-digit, zero-padded integer starting at `000001`.
  71. When a backing index is created, the index is named using the following
  72. convention:
  73. [source,text]
  74. ----
  75. .ds-<data-stream>-<yyyy.MM.dd>-<generation>
  76. ----
  77. `<yyyy.MM.dd>` is the backing index's creation date. Backing indices with a
  78. higher generation contain more recent data. For example, the `web-server-logs`
  79. data stream has a generation of `34`. The stream's most recent backing index,
  80. created on 7 March 2099, is named `.ds-web-server-logs-2099.03.07-000034`.
  81. Some operations, such as a <<indices-shrink-index,shrink>> or
  82. <<snapshots-restore-snapshot,restore>>, can change a backing index's name.
  83. These name changes do not remove a backing index from its data stream.
  84. The generation of the data stream can change without a new index being added to
  85. the data stream (e.g. when an existing backing index is shrunk). This means the
  86. backing indices for some generations will never exist.
  87. You should not derive any intelligence from the backing indices names.
  88. [discrete]
  89. [[data-streams-append-only]]
  90. == Append-only
  91. Data streams are designed for use cases where existing data is rarely,
  92. if ever, updated. You cannot send update or deletion requests for existing
  93. documents directly to a data stream. Instead, use the
  94. <<update-docs-in-a-data-stream-by-query,update by query>> and
  95. <<delete-docs-in-a-data-stream-by-query,delete by query>> APIs.
  96. If needed, you can <<update-delete-docs-in-a-backing-index,update or delete
  97. documents>> by submitting requests directly to the document's backing index.
  98. TIP: If you frequently update or delete existing time series data, use an index
  99. alias with a write index instead of a data stream. See
  100. <<manage-time-series-data-without-data-streams>>.
  101. include::set-up-a-data-stream.asciidoc[]
  102. include::use-a-data-stream.asciidoc[]
  103. include::change-mappings-and-settings.asciidoc[]
  104. include::tsds.asciidoc[]
  105. include::lifecycle/index.asciidoc[]