Skip to content

Commit 83a5256

Browse files
authored
Include date in data stream backing index names (#65205)
1 parent 6ff54c0 commit 83a5256

File tree

49 files changed

+557
-340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+557
-340
lines changed

docs/reference/data-streams/change-mappings-and-settings.asciidoc

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,9 @@ The following get data stream API request retrieves information about
546546
GET /_data_stream/my-data-stream
547547
----
548548

549-
The API returns the following response. Note the `indices` property contains an
550-
array of the stream's current backing indices. The first item in the array
551-
contains information about the stream's oldest backing index,
552-
`.ds-my-data-stream-000001`.
549+
The response's `indices` property contains an array of the stream's current
550+
backing indices. The first item in the array contains information about the
551+
stream's oldest backing index.
553552

554553
[source,console-result]
555554
----
@@ -562,11 +561,11 @@ contains information about the stream's oldest backing index,
562561
},
563562
"indices": [
564563
{
565-
"index_name": ".ds-my-data-stream-000001", <1>
564+
"index_name": ".ds-my-data-stream-2099.03.07-000001", <1>
566565
"index_uuid": "Gpdiyq8sRuK9WuthvAdFbw"
567566
},
568567
{
569-
"index_name": ".ds-my-data-stream-000002",
568+
"index_name": ".ds-my-data-stream-2099.03.08-000002",
570569
"index_uuid": "_eEfRrFHS9OyhqWntkgHAQ"
571570
}
572571
],
@@ -580,29 +579,33 @@ contains information about the stream's oldest backing index,
580579
----
581580
// TESTRESPONSE[s/"index_uuid": "Gpdiyq8sRuK9WuthvAdFbw"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
582581
// TESTRESPONSE[s/"index_uuid": "_eEfRrFHS9OyhqWntkgHAQ"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
582+
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.07-000001"/"index_name": $body.data_streams.0.indices.0.index_name/]
583+
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.08-000002"/"index_name": $body.data_streams.0.indices.1.index_name/]
583584
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]
584585

585-
<1> First item in the `indices` array for `my-data-stream`. This
586-
item contains information about the stream's oldest backing index,
587-
`.ds-my-data-stream-000001`.
586+
<1> First item in the `indices` array for `my-data-stream`. This item contains
587+
information about the stream's oldest backing index,
588+
`.ds-my-data-stream-2099.03.07-000001`.
588589

589590
The following <<docs-reindex,reindex API>> request copies documents from
590-
`.ds-my-data-stream-000001` to `new-data-stream`. Note the request's `op_type`
591-
is `create`.
591+
`.ds-my-data-stream-2099.03.07-000001` to `new-data-stream`. The request's
592+
`op_type` is `create`.
592593

593594
[source,console]
594595
----
595596
POST /_reindex
596597
{
597598
"source": {
598-
"index": ".ds-my-data-stream-000001"
599+
"index": ".ds-my-data-stream-2099.03.07-000001"
599600
},
600601
"dest": {
601602
"index": "new-data-stream",
602603
"op_type": "create"
603604
}
604605
}
605606
----
607+
// TEST[setup:my_index]
608+
// TEST[s/.ds-my-data-stream-2099.03.07-000001/my-index-000001/]
606609
--
607610
+
608611
You can also use a query to reindex only a subset of documents with each

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,13 @@ convention:
9595

9696
[source,text]
9797
----
98-
.ds-<data-stream>-<generation>
98+
.ds-<data-stream>-<yyyy.MM.dd>-<generation>
9999
----
100100

101-
Backing indices with a higher generation contain more recent data. For example,
102-
the `web-server-logs` data stream has a generation of `34`. The stream's most
103-
recent backing index is named `.ds-web-server-logs-000034`.
101+
`<yyyy.MM.dd>` is the backing index's creation date. Backing indices with a
102+
higher generation contain more recent data. For example, the `web-server-logs`
103+
data stream has a generation of `34`. The stream's most recent backing index,
104+
created on 7 March 2099, is named `.ds-web-server-logs-2099.03.07-000034`.
104105

105106
Some operations, such as a <<indices-shrink-index,shrink>> or
106107
<<snapshots-restore-snapshot,restore>>, can change a backing index's name.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ name must match one of your template's index patterns.
137137
----
138138
POST /my-data-stream/_doc/
139139
{
140-
"@timestamp": "2020-12-06T11:04:05.000Z",
140+
"@timestamp": "2099-03-07T11:04:05.000Z",
141141
"user": {
142142
"id": "vlb44hny"
143143
},

docs/reference/data-streams/use-a-data-stream.asciidoc

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ POST /my-data-stream/_rollover/
3232
3333
PUT /my-data-stream/_create/bfspvnIBr7VVZlfp2lqX?refresh=wait_for
3434
{
35-
"@timestamp": "2020-12-07T11:06:07.000Z",
35+
"@timestamp": "2099-03-08T11:06:07.000Z",
3636
"user": {
3737
"id": "yWIumJd7"
3838
},
@@ -61,7 +61,7 @@ To add an individual document, use the <<docs-index_,index API>>.
6161
----
6262
POST /my-data-stream/_doc/
6363
{
64-
"@timestamp": "2020-12-07T11:06:07.000Z",
64+
"@timestamp": "2099-03-08T11:06:07.000Z",
6565
"user": {
6666
"id": "8a4f500d"
6767
},
@@ -81,11 +81,11 @@ Only `create` actions are supported.
8181
----
8282
PUT /my-data-stream/_bulk?refresh
8383
{"create":{ }}
84-
{ "@timestamp": "2020-12-08T11:04:05.000Z", "user": { "id": "vlb44hny" }, "message": "Login attempt failed" }
84+
{ "@timestamp": "2099-03-08T11:04:05.000Z", "user": { "id": "vlb44hny" }, "message": "Login attempt failed" }
8585
{"create":{ }}
86-
{ "@timestamp": "2020-12-08T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
86+
{ "@timestamp": "2099-03-08T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
8787
{"create":{ }}
88-
{ "@timestamp": "2020-12-09T11:07:08.000Z", "user": { "id": "l7gk7f82" }, "message": "Logout successful" }
88+
{ "@timestamp": "2099-03-09T11:07:08.000Z", "user": { "id": "l7gk7f82" }, "message": "Logout successful" }
8989
----
9090

9191
[discrete]
@@ -137,8 +137,10 @@ index API request>> directly to the index:
137137

138138
[source,console]
139139
----
140-
POST /.ds-my-data-stream-000001/_open/
140+
POST /.ds-my-data-stream-2099.03.07-000001/_open/
141141
----
142+
// TEST[setup:my_index]
143+
// TEST[s/.ds-my-data-stream-2099.03.07-000001/my-index-000001/]
142144

143145
To re-open all closed backing indices for a data stream, submit an open index
144146
API request to the stream:
@@ -163,13 +165,13 @@ stream.
163165
----
164166
PUT /_bulk?refresh=wait_for
165167
{"create":{"_index" : "archive_1"}}
166-
{ "@timestamp": "2020-12-08T11:04:05.000Z" }
168+
{ "@timestamp": "2099-03-08T11:04:05.000Z" }
167169
{"create":{"_index" : "archive_2"}}
168-
{ "@timestamp": "2020-12-08T11:06:07.000Z" }
170+
{ "@timestamp": "2099-03-08T11:06:07.000Z" }
169171
{"create":{"_index" : "archive_2"}}
170-
{ "@timestamp": "2020-12-09T11:07:08.000Z" }
172+
{ "@timestamp": "2099-03-09T11:07:08.000Z" }
171173
{"create":{"_index" : "archive_2"}}
172-
{ "@timestamp": "2020-12-09T11:07:08.000Z" }
174+
{ "@timestamp": "2099-03-09T11:07:08.000Z" }
173175
174176
POST /_aliases
175177
{
@@ -288,13 +290,13 @@ Response:
288290
"max_score": 0.2876821,
289291
"hits": [
290292
{
291-
"_index": ".ds-my-data-stream-000003", <1>
293+
"_index": ".ds-my-data-stream-2099.03.08-000003", <1>
292294
"_id": "bfspvnIBr7VVZlfp2lqX", <2>
293295
"_seq_no": 0, <3>
294296
"_primary_term": 1, <4>
295297
"_score": 0.2876821,
296298
"_source": {
297-
"@timestamp": "2020-12-07T11:06:07.000Z",
299+
"@timestamp": "2099-03-08T11:06:07.000Z",
298300
"user": {
299301
"id": "yWIumJd7"
300302
},
@@ -307,6 +309,7 @@ Response:
307309
----
308310
// TESTRESPONSE[s/"took": 20/"took": $body.took/]
309311
// TESTRESPONSE[s/"max_score": 0.2876821/"max_score": $body.hits.max_score/]
312+
// TESTRESPONSE[s/"_index": ".ds-my-data-stream-2099.03.08-000003"/"_index": $body.hits.hits.0._index/]
310313
// TESTRESPONSE[s/"_score": 0.2876821/"_score": $body.hits.hits.0._score/]
311314

312315
<1> Backing index containing the matching document
@@ -319,22 +322,29 @@ To update the document, use an <<docs-index_,index API>> request with valid
319322

320323
[source,console]
321324
----
322-
PUT /.ds-my-data-stream-000003/_doc/bfspvnIBr7VVZlfp2lqX?if_seq_no=0&if_primary_term=1
325+
PUT /.ds-my-data-stream-2099-03-08-000003/_doc/bfspvnIBr7VVZlfp2lqX?if_seq_no=0&if_primary_term=1
323326
{
324-
"@timestamp": "2020-12-07T11:06:07.000Z",
327+
"@timestamp": "2099-03-08T11:06:07.000Z",
325328
"user": {
326329
"id": "8a4f500d"
327330
},
328331
"message": "Login successful"
329332
}
330333
----
334+
// TEST[setup:my_index]
335+
// TEST[s/.ds-my-data-stream-2099.03.08-000003/my-index-000001/]
336+
// TEST[s/bfspvnIBr7VVZlfp2lqX/1/]
337+
// TEST[s/if_seq_no=0/if_seq_no=1/]
331338

332339
To delete the document, use the <<docs-delete,delete API>>:
333340

334341
[source,console]
335342
----
336-
DELETE /.ds-my-data-stream-000003/_doc/bfspvnIBr7VVZlfp2lqX
343+
DELETE /.ds-my-data-stream-2099.03.08-000003/_doc/bfspvnIBr7VVZlfp2lqX
337344
----
345+
// TEST[setup:my_index]
346+
// TEST[s/.ds-my-data-stream-2099.03.08-000003/my-index-000001/]
347+
// TEST[s/bfspvnIBr7VVZlfp2lqX/1/]
338348

339349
To delete or update multiple documents with a single request, use the
340350
<<docs-bulk,bulk API>>'s `delete`, `index`, and `update` actions. For `index`
@@ -344,7 +354,10 @@ actions, include valid <<bulk-optimistic-concurrency-control,`if_seq_no` and
344354
[source,console]
345355
----
346356
PUT /_bulk?refresh
347-
{ "index": { "_index": ".ds-my-data-stream-000003", "_id": "bfspvnIBr7VVZlfp2lqX", "if_seq_no": 0, "if_primary_term": 1 } }
348-
{ "@timestamp": "2020-12-07T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
357+
{ "index": { "_index": ".ds-my-data-stream-2099.03.08-000003", "_id": "bfspvnIBr7VVZlfp2lqX", "if_seq_no": 0, "if_primary_term": 1 } }
358+
{ "@timestamp": "2099-03-08T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
349359
----
360+
// TEST[setup:my_index]
361+
// TEST[s/.ds-my-data-stream-2099.03.08-000003/my-index-000001/]
362+
// TEST[s/bfspvnIBr7VVZlfp2lqX/1/]
350363

docs/reference/ilm/ilm-tutorial.asciidoc

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ indices.
3131
. <<ilm-gs-check-progress, Verify indices are moving through the lifecycle phases>>
3232
as expected.
3333

34-
For an introduction to rolling indices, see <<index-rollover>>.
34+
For an introduction to rolling indices, see <<index-rollover>>.
3535

3636
IMPORTANT: When you enable {ilm} for {beats} or the {ls} {es} output plugin,
3737
lifecycle policies are set up automatically.
@@ -46,17 +46,17 @@ or the {ilm-init} APIs.
4646

4747
A lifecycle policy specifies the phases in the index lifecycle
4848
and the actions to perform in each phase. A lifecycle can have up to four phases:
49-
`hot`, `warm`, `cold`, and `delete`.
49+
`hot`, `warm`, `cold`, and `delete`.
5050

5151
For example, you might define a `timeseries_policy` that has two phases:
52-
53-
* A `hot` phase that defines a rollover action to specify that an index rolls over when it
52+
53+
* A `hot` phase that defines a rollover action to specify that an index rolls over when it
5454
reaches either a `max_size` of 50 gigabytes or a `max_age` of 30 days.
5555
* A `delete` phase that sets `min_age` to remove the index 90 days after rollover.
56-
Note that this value is relative to the rollover time, not the index creation time.
56+
Note that this value is relative to the rollover time, not the index creation time.
5757

58-
You can create the policy through {kib} or with the
59-
<<ilm-put-lifecycle, put policy>> API.
58+
You can create the policy through {kib} or with the
59+
<<ilm-put-lifecycle, put policy>> API.
6060
To create the policy from {kib}, open the menu and go to *Stack Management >
6161
Index Lifecycle Policies*. Click *Index Lifecycle Policies*.
6262

@@ -154,8 +154,8 @@ request automatically creates a corresponding data stream with a single backing
154154
{es} automatically indexes the request's documents into this backing index, which also
155155
acts as the stream's <<data-stream-write-index,write index>>.
156156

157-
For example, the following request creates the `timeseries` data stream and the first generation
158-
backing index called `.ds-timeseries-000001`.
157+
For example, the following request creates the `timeseries` data stream and the
158+
first generation backing index called `.ds-timeseries-2099.03.08-000001`.
159159

160160
[source,console]
161161
-----------------------
@@ -170,10 +170,13 @@ POST timeseries/_doc
170170

171171
When a rollover condition in the lifecycle policy is met, the `rollover` action:
172172

173-
* Creates the second generation backing index, named `.ds-timeseries-000002`.
174-
Because it is a backing index of the `timeseries` data stream, the configuration from the `timeseries_template` index template is applied to the new index.
175-
* As it is the latest generation index of the `timeseries` data stream, the newly created
176-
backing index `.ds-timeseries-000002` becomes the data stream's write index.
173+
* Creates the second generation backing index, named
174+
`.ds-timeseries-2099.03.08-000002`. Because it is a backing index of the
175+
`timeseries` data stream, the configuration from the `timeseries_template` index
176+
template is applied to the new index.
177+
* As it is the latest generation index of the `timeseries` data stream, the
178+
newly created backing index `.ds-timeseries-2099.03.08-000002` becomes the data
179+
stream's write index.
177180

178181
This process repeats each time a rollover condition is met.
179182
You can search across all of the data stream's backing indices, managed by the `timeseries_policy`,
@@ -211,8 +214,8 @@ is met.
211214
--------------------------------------------------
212215
{
213216
"indices": {
214-
".ds-timeseries-000001": {
215-
"index": ".ds-timeseries-000001",
217+
".ds-timeseries-2099.03.07-000001": {
218+
"index": ".ds-timeseries-2099.03.07-000001",
216219
"managed": true,
217220
"policy": "timeseries_policy", <1>
218221
"lifecycle_date_millis": 1538475653281,

docs/reference/images/data-streams/data-streams-diagram.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/reference/images/data-streams/data-streams-index-request.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/reference/images/data-streams/data-streams-search-request.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/reference/indices/forcemerge.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ its shards can be force-merged to a single segment.
176176

177177
[source,console]
178178
--------------------------------------------------
179-
POST /.ds-logs-000001/_forcemerge?max_num_segments=1
179+
POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1
180180
--------------------------------------------------
181181
// TEST[setup:my_index]
182-
// TEST[s/.ds-logs-000001/my-index-000001/]
182+
// TEST[s/.ds-my-data-stream-2099.03.07-000001/my-index-000001/]
183183

184184
This can be a good idea because single-segment shards can sometimes use simpler
185185
and more efficient data structures to perform searches.

docs/reference/indices/get-data-stream.asciidoc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ PUT /_data_stream/my-data-stream
5050
5151
POST /my-data-stream/_rollover
5252
53-
PUT /_data_stream/my-data-stream_two
53+
PUT /_data_stream/my-data-stream-two
5454
----
5555
// TESTSETUP
5656
////
@@ -207,11 +207,11 @@ The API returns the following response:
207207
},
208208
"indices": [
209209
{
210-
"index_name": ".ds-my-data-stream-000001",
210+
"index_name": ".ds-my-data-stream-2099.03.07-000001",
211211
"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"
212212
},
213213
{
214-
"index_name": ".ds-my-data-stream-000002",
214+
"index_name": ".ds-my-data-stream-2099.03.08-000002",
215215
"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"
216216
}
217217
],
@@ -225,13 +225,13 @@ The API returns the following response:
225225
"hidden": false
226226
},
227227
{
228-
"name": "my-data-stream_two",
228+
"name": "my-data-stream-two",
229229
"timestamp_field": {
230230
"name": "@timestamp"
231231
},
232232
"indices": [
233233
{
234-
"index_name": ".ds-my-data-stream_two-000001",
234+
"index_name": ".ds-my-data-stream-two-2099.03.08-000001",
235235
"index_uuid": "3liBu2SYS5axasRt6fUIpA"
236236
}
237237
],
@@ -247,7 +247,10 @@ The API returns the following response:
247247
]
248248
}
249249
----
250+
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.07-000001"/"index_name": $body.data_streams.0.indices.0.index_name/]
250251
// TESTRESPONSE[s/"index_uuid": "xCEhwsp8Tey0-FLNFYVwSg"/"index_uuid": $body.data_streams.0.indices.0.index_uuid/]
252+
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-2099.03.08-000002"/"index_name": $body.data_streams.0.indices.1.index_name/]
251253
// TESTRESPONSE[s/"index_uuid": "PA_JquKGSiKcAKBA8DJ5gw"/"index_uuid": $body.data_streams.0.indices.1.index_uuid/]
254+
// TESTRESPONSE[s/"index_name": ".ds-my-data-stream-two-2099.03.08-000001"/"index_name": $body.data_streams.1.indices.0.index_name/]
252255
// TESTRESPONSE[s/"index_uuid": "3liBu2SYS5axasRt6fUIpA"/"index_uuid": $body.data_streams.1.indices.0.index_uuid/]
253256
// TESTRESPONSE[s/"status": "GREEN"/"status": "YELLOW"/]

0 commit comments

Comments
 (0)