diff --git a/docs/reference/data-streams/data-streams.asciidoc b/docs/reference/data-streams/data-streams.asciidoc index 88375ef4ca6d9..ad6dbe083c69d 100644 --- a/docs/reference/data-streams/data-streams.asciidoc +++ b/docs/reference/data-streams/data-streams.asciidoc @@ -74,10 +74,8 @@ such as: [[data-streams-rollover]] == Rollover -When you create a data stream, {es} automatically creates a backing index for -the stream. This index also acts as the stream's first write index. A -<> creates a new backing index that becomes the -stream's new write index. +A <> creates a new backing index that becomes +the stream's new write index. We recommend using <> to automatically roll over data streams when the write index reaches a specified age or size. diff --git a/docs/reference/data-streams/set-up-a-data-stream.asciidoc b/docs/reference/data-streams/set-up-a-data-stream.asciidoc index 95ef91a4f191e..b4b66c17ecbfe 100644 --- a/docs/reference/data-streams/set-up-a-data-stream.asciidoc +++ b/docs/reference/data-streams/set-up-a-data-stream.asciidoc @@ -9,6 +9,9 @@ To set up a data stream, follow these steps: . <>. . <>. +You can also <>. + [discrete] [[configure-a-data-stream-ilm-policy]] === Optional: Configure an {ilm-init} lifecycle policy @@ -154,6 +157,73 @@ PUT /_data_stream/my-data-stream // TEST[continued] // TEST[s/my-data-stream/my-data-stream-alt/] +When you create a data stream, {es} automatically creates a backing index for +the stream. This index also acts as the stream's first write index. + +[discrete] +[[convert-an-index-alias-to-a-data-stream]] +=== Convert an index alias to a data stream + +Prior to {es} 7.9, you would typically use an <> +with a write index to manage time series data. Data streams replace most of +this functionality and usually require less maintenance. + +To convert an index alias with a write index to a new data stream with the same +name, use the <>. +During conversion, the alias’s indices become hidden backing indices for the +stream. The alias’s write index becomes the stream’s write index. Note the data +stream still requires a matching <>. + +//// +[source,console] +---- +POST idx1/_doc/ +{ + "message" : "testing", + "@timestamp" : "2099-01-01" +} + +POST idx2/_doc/ +{ + "message" : "testing2", + "@timestamp" : "2099-01-01" +} + +POST /_aliases +{ + "actions": [ + { + "add": { + "index": "idx1", + "alias": "my-time-series-data", + "is_write_index": true + } + }, + { + "add": { + "index": "idx2", + "alias": "my-time-series-data" + } + } + ] +} + +PUT /_index_template/template +{ + "index_patterns": ["my-time-series-data"], + "data_stream": { } +} +---- +// TEST[continued] +//// + +[source,console] +---- +POST /_data_stream/_migrate/my-time-series-data +---- +// TEST[continued] + [discrete] [[secure-a-data-stream]] === Secure the data stream