@@ -9,6 +9,9 @@ To set up a data stream, follow these steps:
9
9
. <<create-a-data-stream>>.
10
10
. <<secure-a-data-stream>>.
11
11
12
+ You can also <<convert-an-index-alias-to-a-data-stream,convert an existing index
13
+ alias to a data stream>>.
14
+
12
15
[discrete]
13
16
[[configure-a-data-stream-ilm-policy]]
14
17
=== Optional: Configure an {ilm-init} lifecycle policy
@@ -154,6 +157,73 @@ PUT /_data_stream/my-data-stream
154
157
// TEST[continued]
155
158
// TEST[s/my-data-stream/my-data-stream-alt/]
156
159
160
+ When you create a data stream, {es} automatically creates a backing index for
161
+ the stream. This index also acts as the stream's first write index.
162
+
163
+ [discrete]
164
+ [[convert-an-index-alias-to-a-data-stream]]
165
+ === Convert an index alias to a data stream
166
+
167
+ Prior to {es} 7.9, you would typically use an <<indices-aliases,index alias>>
168
+ with a write index to manage time series data. Data streams replace most of
169
+ this functionality and usually require less maintenance.
170
+
171
+ To convert an index alias with a write index to a new data stream with the same
172
+ name, use the <<indices-migrate-to-data-stream,migrate to data stream API>>.
173
+ During conversion, the alias’s indices become hidden backing indices for the
174
+ stream. The alias’s write index becomes the stream’s write index. Note the data
175
+ stream still requires a matching <<create-a-data-stream-template,index
176
+ template>>.
177
+
178
+ ////
179
+ [source,console]
180
+ ----
181
+ POST idx1/_doc/
182
+ {
183
+ "message" : "testing",
184
+ "@timestamp" : "2099-01-01"
185
+ }
186
+
187
+ POST idx2/_doc/
188
+ {
189
+ "message" : "testing2",
190
+ "@timestamp" : "2099-01-01"
191
+ }
192
+
193
+ POST /_aliases
194
+ {
195
+ "actions": [
196
+ {
197
+ "add": {
198
+ "index": "idx1",
199
+ "alias": "my-time-series-data",
200
+ "is_write_index": true
201
+ }
202
+ },
203
+ {
204
+ "add": {
205
+ "index": "idx2",
206
+ "alias": "my-time-series-data"
207
+ }
208
+ }
209
+ ]
210
+ }
211
+
212
+ PUT /_index_template/template
213
+ {
214
+ "index_patterns": ["my-time-series-data"],
215
+ "data_stream": { }
216
+ }
217
+ ----
218
+ // TEST[continued]
219
+ ////
220
+
221
+ [source,console]
222
+ ----
223
+ POST /_data_stream/_migrate/my-time-series-data
224
+ ----
225
+ // TEST[continued]
226
+
157
227
[discrete]
158
228
[[secure-a-data-stream]]
159
229
=== Secure the data stream
0 commit comments