Skip to content

Commit 83eabfc

Browse files
jrodewigdanhermann
andauthored
[DOCS] Data stream migration API (#65017) (#66786)
Co-authored-by: Dan Hermann <[email protected]>
1 parent e4bb837 commit 83eabfc

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The following APIs are available for managing <<data-streams,data streams>>:
77
* <<indices-create-data-stream>>
88
* <<indices-delete-data-stream>>
99
* <<indices-get-data-stream>>
10+
* <<indices-migrate-to-data-stream>>
1011
* <<data-stream-stats-api>>
1112
* <<promote-data-stream-api>>
1213

@@ -18,6 +19,8 @@ include::{es-repo-dir}/indices/delete-data-stream.asciidoc[]
1819

1920
include::{es-repo-dir}/indices/get-data-stream.asciidoc[]
2021

22+
include::{es-repo-dir}/indices/migrate-to-data-stream.asciidoc[]
23+
2124
include::{es-repo-dir}/indices/data-stream-stats.asciidoc[]
2225

2326
include::{es-repo-dir}/data-streams/promote-data-stream-api.asciidoc[]
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[role="xpack"]
2+
[[indices-migrate-to-data-stream]]
3+
=== Migrate to data stream API
4+
++++
5+
<titleabbrev>Migrate to data stream</titleabbrev>
6+
++++
7+
8+
Converts an <<indices-aliases,index alias>> to a <<data-streams,data stream>>.
9+
10+
Data streams require a matching <<indices-templates,index template>>.
11+
See <<set-up-a-data-stream>>.
12+
13+
////
14+
[source,console]
15+
----
16+
POST idx1/_doc/
17+
{
18+
"message" : "testing",
19+
"@timestamp" : "2020-01-01"
20+
}
21+
22+
POST idx2/_doc/
23+
{
24+
"message" : "testing2",
25+
"@timestamp" : "2020-01-01"
26+
}
27+
28+
POST /_aliases
29+
{
30+
"actions": [
31+
{
32+
"add": {
33+
"index": "idx1",
34+
"alias": "my-logs",
35+
"is_write_index": true
36+
}
37+
},
38+
{
39+
"add": {
40+
"index": "idx2",
41+
"alias": "my-logs"
42+
}
43+
}
44+
]
45+
}
46+
47+
PUT /_index_template/template
48+
{
49+
"index_patterns": ["my-logs*"],
50+
"data_stream": { }
51+
}
52+
----
53+
////
54+
55+
[source,console]
56+
----
57+
POST /_data_stream/_migrate/my-logs
58+
----
59+
// TEST[continued]
60+
61+
////
62+
[source,console]
63+
-----------------------------------
64+
DELETE /_data_stream/my-logs
65+
DELETE /_index_template/template
66+
-----------------------------------
67+
// TEST[continued]
68+
////
69+
70+
[[indices-migrate-to-data-stream-request]]
71+
==== {api-request-title}
72+
73+
`POST /_data_stream/_migrate/<alias>`
74+
75+
[[indices-migrate-to-data-stream-api-path-params]]
76+
==== {api-path-parms-title}
77+
78+
`<alias>`::
79+
+
80+
--
81+
(Required, string)
82+
Name of the index alias to convert to a data stream. The alias must meet the
83+
following criteria:
84+
85+
- The alias must have a <<aliases-write-index,write index>>.
86+
- All indices for the alias have a `@timestamp` field mapping of a `date` or `date_nanos` field type.
87+
- The alias must not have any <<filtered,filters>>.
88+
- The alias must not use <<aliases-routing,custom routing>>.
89+
90+
If successful, the request removes the alias and creates a data stream with the
91+
same name. The alias's indices become hidden backing indices for the stream. The
92+
alias's write index becomes the stream's write index.
93+
--

0 commit comments

Comments
 (0)