Skip to content

Commit 9354d2f

Browse files
authored
[DOCS] Add index alias conversion to data stream setup docs (#65979) (#66788)
1 parent bc08ede commit 9354d2f

File tree

2 files changed

+72
-4
lines changed

2 files changed

+72
-4
lines changed

docs/reference/data-streams/data-streams.asciidoc

+2-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ such as:
7474
[[data-streams-rollover]]
7575
== Rollover
7676

77-
When you create a data stream, {es} automatically creates a backing index for
78-
the stream. This index also acts as the stream's first write index. A
79-
<<indices-rollover-index,rollover>> creates a new backing index that becomes the
80-
stream's new write index.
77+
A <<indices-rollover-index,rollover>> creates a new backing index that becomes
78+
the stream's new write index.
8179

8280
We recommend using <<index-lifecycle-management,{ilm-init}>> to automatically
8381
roll over data streams when the write index reaches a specified age or size.

docs/reference/data-streams/set-up-a-data-stream.asciidoc

+70
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ To set up a data stream, follow these steps:
99
. <<create-a-data-stream>>.
1010
. <<secure-a-data-stream>>.
1111

12+
You can also <<convert-an-index-alias-to-a-data-stream,convert an existing index
13+
alias to a data stream>>.
14+
1215
[discrete]
1316
[[configure-a-data-stream-ilm-policy]]
1417
=== Optional: Configure an {ilm-init} lifecycle policy
@@ -154,6 +157,73 @@ PUT /_data_stream/my-data-stream
154157
// TEST[continued]
155158
// TEST[s/my-data-stream/my-data-stream-alt/]
156159

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+
157227
[discrete]
158228
[[secure-a-data-stream]]
159229
=== Secure the data stream

0 commit comments

Comments
 (0)