Skip to content

Commit

Permalink
Change default backing index naming scheme (#57721)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann committed Jun 8, 2020
1 parent 76c7e32 commit 904bdae
Show file tree
Hide file tree
Showing 34 changed files with 192 additions and 157 deletions.
4 changes: 2 additions & 2 deletions docs/reference/data-streams.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template>> containing:

* A name or wildcard pattern for the data stream in the `index_patterns` property.
* A `data_stream` definition that contains the `timestamp_field` property.
The `timestamp_field` must be the primary timestamp field
The `timestamp_field` must be the primary timestamp field
for the data source. This field must be included in every
document indexed to the data stream.

Expand Down Expand Up @@ -77,7 +77,7 @@ Response:
"failed" : 0,
"successful" : 1
},
"_index" : "logs-foobar-000001",
"_index" : ".ds-logs-foobar-000001",
"_id" : "W0tpsmIBdwcYyG50zbta",
"_version" : 1,
"_seq_no" : 0,
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/indices/get-data-stream.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ The API returns the following response:
"timestamp_field" : "@timestamp", <2>
"indices" : [ <3>
{
"index_name" : "my-data-stream-000001",
"index_name" : ".ds-my-data-stream-000001",
"index_uuid" : "DXAE-xcCQTKF93bMm9iawA"
},
{
"index_name" : "my-data-stream-000002",
"index_name" : ".ds-my-data-stream-000002",
"index_uuid" : "Wzxq0VhsQKyPxHhaK3WYAg"
}
],
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/indices/rollover-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ POST /my-data-stream/_rollover <2>
--------------------------------------------------
// TEST[continued]
// TEST[setup:huge_twitter]
// TEST[s/# Add > 1000 documents to my-data-stream/POST _reindex?refresh\n{"source":{"index":"twitter"},"dest":{"index":"my-data-stream-000001"}}/]
// TEST[s/# Add > 1000 documents to my-data-stream/POST _reindex?refresh\n{"source":{"index":"twitter"},"dest":{"index":".ds-my-data-stream-000001"}}/]
<1> Creates a data stream called `my-data-stream` with one initial backing index
named `my-data-stream-000001`.
<2> This request creates a new backing index, `my-data-stream-000002`, and adds
Expand All @@ -274,8 +274,8 @@ The API returns the following response:
{
"acknowledged": true,
"shards_acknowledged": true,
"old_index": "my-data-stream-000001", <1>
"new_index": "my-data-stream-000002", <2>
"old_index": ".ds-my-data-stream-000001", <1>
"new_index": ".ds-my-data-stream-000002", <2>
"rolled_over": true, <3>
"dry_run": false, <4>
"conditions": { <5>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ setup:
---
"Create data stream":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"

- do:
indices.create_data_stream:
Expand All @@ -43,12 +43,12 @@ setup:
- match: { 0.timestamp_field: '@timestamp' }
- match: { 0.generation: 1 }
- length: { 0.indices: 1 }
- match: { 0.indices.0.index_name: 'simple-data-stream1-000001' }
- match: { 0.indices.0.index_name: '.ds-simple-data-stream1-000001' }
- match: { 1.name: simple-data-stream2 }
- match: { 1.timestamp_field: '@timestamp2' }
- match: { 0.generation: 1 }
- length: { 1.indices: 1 }
- match: { 1.indices.0.index_name: 'simple-data-stream2-000001' }
- match: { 1.indices.0.index_name: '.ds-simple-data-stream2-000001' }

- do:
index:
Expand All @@ -64,7 +64,7 @@ setup:
index: simple-data-stream1
body: { query: { match_all: {} } }
- length: { hits.hits: 1 }
- match: { hits.hits.0._index: simple-data-stream1-000001 }
- match: { hits.hits.0._index: .ds-simple-data-stream1-000001 }
- match: { hits.hits.0._source.foo: 'bar' }

- do:
Expand Down Expand Up @@ -95,8 +95,8 @@ setup:
---
"Get data stream":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"

- do:
indices.create_data_stream:
Expand Down Expand Up @@ -160,8 +160,8 @@ setup:
---
"Delete data stream with backing indices":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"

- do:
indices.create_data_stream:
Expand All @@ -178,18 +178,18 @@ setup:

- do:
indices.get:
index: ['simple-data-stream1-000001', 'test_index']
index: ['.ds-simple-data-stream1-000001', 'test_index']

- is_true: test_index.settings
- is_true: simple-data-stream1-000001.settings
- is_true: \.ds-simple-data-stream1-000001.settings

- do:
indices.get_data_stream: {}
- match: { 0.name: simple-data-stream1 }
- match: { 0.timestamp_field: '@timestamp' }
- match: { 0.generation: 1 }
- length: { 0.indices: 1 }
- match: { 0.indices.0.index_name: 'simple-data-stream1-000001' }
- match: { 0.indices.0.index_name: '.ds-simple-data-stream1-000001' }

- do:
indices.delete_data_stream:
Expand All @@ -199,4 +199,4 @@ setup:
- do:
catch: missing
indices.get:
index: "simple-data-stream1-000001"
index: ".ds-simple-data-stream1-000001"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Test apis that do not supported data streams":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"
features: allowed_warnings

- do:
Expand All @@ -25,14 +25,14 @@
index: logs-foobar
refresh: true
body: { foo: bar }
- match: {_index: logs-foobar-000001}
- match: {_index: .ds-logs-foobar-000001}

- do:
search:
index: logs-foobar
body: { query: { match_all: {} } }
- length: { hits.hits: 1 }
- match: { hits.hits.0._index: logs-foobar-000001 }
- match: { hits.hits.0._index: .ds-logs-foobar-000001 }
- match: { hits.hits.0._source.foo: 'bar' }

- do:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Put index template":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"
features: allowed_warnings

- do:
Expand Down Expand Up @@ -34,7 +34,7 @@
index: logs-foobar
body: { query: { match_all: {} } }
- length: { hits.hits: 1 }
- match: { hits.hits.0._index: logs-foobar-000001 }
- match: { hits.hits.0._index: .ds-logs-foobar-000001 }
- match: { hits.hits.0._source.foo: 'bar' }

- do:
Expand All @@ -43,7 +43,7 @@
- match: { 0.name: logs-foobar }
- match: { 0.timestamp_field: 'timestamp' }
- length: { 0.indices: 1 }
- match: { 0.indices.0.index_name: 'logs-foobar-000001' }
- match: { 0.indices.0.index_name: '.ds-logs-foobar-000001' }

- do:
indices.delete_data_stream:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ teardown:
- do:
indices.get:
index: logs-foobar
- is_true: logs-foobar-000001
- is_true: \.ds-logs-foobar-000001
- is_false: logs-foobar
- match: { logs-foobar-000001.settings.index.number_of_shards: '1' }
- match: { \.ds-logs-foobar-000001.settings.index.number_of_shards: '1' }

---
"Verify get mapping api":
Expand All @@ -44,5 +44,5 @@ teardown:
- do:
indices.get_mapping:
index: logs-foobar
- is_true: logs-foobar-000001.mappings
- is_false: logs-foobar.mappings
- is_true: \.ds-logs-foobar-000001.mappings
- is_false: \.ds-logs-foobar.mappings
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ setup:
---
"Delete backing index on data stream":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"

- do:
indices.create_data_stream:
Expand All @@ -27,25 +27,25 @@ setup:
indices.rollover:
alias: "simple-data-stream"

- match: { old_index: simple-data-stream-000001 }
- match: { new_index: simple-data-stream-000002 }
- match: { old_index: .ds-simple-data-stream-000001 }
- match: { new_index: .ds-simple-data-stream-000002 }
- match: { rolled_over: true }
- match: { dry_run: false }

# ensure new index is created
- do:
indices.exists:
index: simple-data-stream-000002
index: .ds-simple-data-stream-000002

- is_true: ''

- do:
indices.delete:
index: simple-data-stream-000001
index: .ds-simple-data-stream-000001

- do:
indices.exists:
index: simple-data-stream-000001
index: .ds-simple-data-stream-000001

- is_false: ''

Expand All @@ -56,7 +56,7 @@ setup:
- match: { 0.timestamp_field: '@timestamp' }
- match: { 0.generation: 2 }
- length: { 0.indices: 1 }
- match: { 0.indices.0.index_name: 'simple-data-stream-000002' }
- match: { 0.indices.0.index_name: '.ds-simple-data-stream-000002' }

- do:
indices.delete_data_stream:
Expand All @@ -79,26 +79,26 @@ setup:
indices.rollover:
alias: "simple-data-stream"

- match: { old_index: simple-data-stream-000001 }
- match: { new_index: simple-data-stream-000002 }
- match: { old_index: .ds-simple-data-stream-000001 }
- match: { new_index: .ds-simple-data-stream-000002 }
- match: { rolled_over: true }
- match: { dry_run: false }

# ensure new index is created
- do:
indices.exists:
index: simple-data-stream-000002
index: .ds-simple-data-stream-000002

- is_true: ''

- do:
catch: bad_request
indices.delete:
index: simple-data-stream-000002
index: .ds-simple-data-stream-000002

- do:
indices.exists:
index: simple-data-stream-000002
index: .ds-simple-data-stream-000002

- is_true: ''

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Get backing indices for data stream":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"
features: allowed_warnings

- do:
Expand Down Expand Up @@ -30,11 +30,11 @@

- do:
indices.get:
index: ['data-stream1-000001', 'test_index']
index: ['.ds-data-stream1-000001', 'test_index']

- is_true: data-stream1-000001.settings
- is_true: data-stream1-000001.data_stream
- match: { data-stream1-000001.data_stream: data-stream1 }
- is_true: \.ds-data-stream1-000001.settings
- is_true: \.ds-data-stream1-000001.data_stream
- match: { \.ds-data-stream1-000001.data_stream: data-stream1 }
- is_true: test_index.settings
- is_false: test_index.data_stream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
- do:
catch: bad_request
indices.close:
index: "simple-data-stream1-000001"
index: ".ds-simple-data-stream1-000001"

- do:
indices.delete_data_stream:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Roll over a data stream":
- skip:
version: " - 7.8.99"
reason: "data streams only supported in 7.9+"
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"
features: allowed_warnings

- do:
Expand All @@ -25,15 +25,15 @@
indices.rollover:
alias: "data-stream-for-rollover"

- match: { old_index: data-stream-for-rollover-000001 }
- match: { new_index: data-stream-for-rollover-000002 }
- match: { old_index: .ds-data-stream-for-rollover-000001 }
- match: { new_index: .ds-data-stream-for-rollover-000002 }
- match: { rolled_over: true }
- match: { dry_run: false }

# ensure new index is created
- do:
indices.exists:
index: data-stream-for-rollover-000002
index: .ds-data-stream-for-rollover-000002

- is_true: ''

Expand All @@ -44,8 +44,8 @@
- match: { 0.timestamp_field: '@timestamp' }
- match: { 0.generation: 2 }
- length: { 0.indices: 2 }
- match: { 0.indices.0.index_name: 'data-stream-for-rollover-000001' }
- match: { 0.indices.1.index_name: 'data-stream-for-rollover-000002' }
- match: { 0.indices.0.index_name: '.ds-data-stream-for-rollover-000001' }
- match: { 0.indices.1.index_name: '.ds-data-stream-for-rollover-000002' }

- do:
indices.delete_data_stream:
Expand Down

0 comments on commit 904bdae

Please sign in to comment.