Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Add index alias conversion to data stream setup docs #65979

Merged
merged 5 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions docs/reference/data-streams/data-streams.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
<<indices-rollover-index,rollover>> creates a new backing index that becomes the
stream's new write index.
jrodewig marked this conversation as resolved.
Show resolved Hide resolved
A <<indices-rollover-index,rollover>> creates a new backing index that becomes
the stream's new write index.

We recommend using <<index-lifecycle-management,{ilm-init}>> to automatically
roll over data streams when the write index reaches a specified age or size.
Expand Down
67 changes: 67 additions & 0 deletions docs/reference/data-streams/set-up-a-data-stream.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ To set up a data stream, follow these steps:
. <<create-a-data-stream>>.
. <<secure-a-data-stream>>.

You can also <<convert-an-index-alias-to-a-data-stream,convert an existing index
alias to a data stream>>.

[discrete]
[[configure-a-data-stream-ilm-policy]]
=== Optional: Configure an {ilm-init} lifecycle policy
Expand Down Expand Up @@ -154,6 +157,70 @@ PUT /_data_stream/my-data-stream
// TEST[continued]
// TEST[s/my-data-stream/my-data-stream-alt/]

[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 <<indices-aliases,index alias>>
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 <<indices-migrate-to-data-stream,migrate to data stream API>>.
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 <<create-a-data-stream-template,index
template>>.

jrodewig marked this conversation as resolved.
Show resolved Hide resolved
////
[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
Expand Down