|
@@ -1,111 +0,0 @@
|
|
|
----
|
|
|
-"Test that datastream index segments are sorted on timestamp field desc after data stream migration":
|
|
|
- - skip:
|
|
|
- version: " - 7.15.99"
|
|
|
- reason: "sorting segments was added in 7.16"
|
|
|
- features: allowed_warnings
|
|
|
-
|
|
|
- - do:
|
|
|
- allowed_warnings:
|
|
|
- - "index template [my-template] has index patterns [my_ds] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template] will take precedence during new index creation"
|
|
|
- indices.put_index_template:
|
|
|
- name: my-template
|
|
|
- body:
|
|
|
- index_patterns: [ my_ds ]
|
|
|
- data_stream: { }
|
|
|
- template:
|
|
|
- settings:
|
|
|
- number_of_shards: 1
|
|
|
- number_of_replicas: 0
|
|
|
-
|
|
|
- - do:
|
|
|
- indices.create:
|
|
|
- index: test_index1
|
|
|
- body:
|
|
|
- settings:
|
|
|
- number_of_shards: 1
|
|
|
- number_of_replicas: 0
|
|
|
- aliases:
|
|
|
- my_ds:
|
|
|
- is_write_index: true
|
|
|
-
|
|
|
- # 1st segment
|
|
|
- - do:
|
|
|
- index:
|
|
|
- index: my_ds
|
|
|
- body: { "foo": "bar1", "@timestamp": "2021-08-01" }
|
|
|
- refresh: true
|
|
|
-
|
|
|
- # 2nd segment
|
|
|
- - do:
|
|
|
- index:
|
|
|
- index: my_ds
|
|
|
- body: { "foo": "bar2", "@timestamp": "2021-08-02" }
|
|
|
- refresh: true
|
|
|
-
|
|
|
- # test that segments are sorted as indexed by @timestamp ASC
|
|
|
- - do:
|
|
|
- search:
|
|
|
- index: my_ds
|
|
|
- body:
|
|
|
- fields: [{ "field":"@timestamp", "format":"yyyy-MM-dd" }]
|
|
|
- - match: { hits.total.value: 2 }
|
|
|
- - match: { hits.hits.0.fields.@timestamp: ["2021-08-01"] }
|
|
|
- - match: { hits.hits.1.fields.@timestamp: ["2021-08-02"] }
|
|
|
-
|
|
|
- # migrate to data-stream
|
|
|
- - do:
|
|
|
- indices.migrate_to_data_stream:
|
|
|
- name: my_ds
|
|
|
- - is_true: acknowledged
|
|
|
-
|
|
|
- # test that segments are still sorted as indexed by @timestamp ASC
|
|
|
- # as we don't reopen existing shards and index readers after migration
|
|
|
- - do:
|
|
|
- search:
|
|
|
- index: my_ds
|
|
|
- body:
|
|
|
- fields: [{ "field":"@timestamp", "format":"yyyy-MM-dd" }]
|
|
|
- - match: { hits.total.value: 2 }
|
|
|
- - match: { hits.hits.0.fields.@timestamp: ["2021-08-01"] }
|
|
|
- - match: { hits.hits.1.fields.@timestamp: ["2021-08-02"] }
|
|
|
-
|
|
|
- # rollover data stream to create new backing index
|
|
|
- - do:
|
|
|
- indices.rollover:
|
|
|
- alias: "my_ds"
|
|
|
- - match: { rolled_over: true }
|
|
|
- # save the new backing index names for later use
|
|
|
- - set: { new_index: idx0name }
|
|
|
-
|
|
|
- # 1st segment in the new backing index
|
|
|
- - do:
|
|
|
- index:
|
|
|
- index: my_ds
|
|
|
- body: { "foo": "bar3", "@timestamp": "2021-08-03" }
|
|
|
- refresh: true
|
|
|
-
|
|
|
- # 2nd segment in the new backing index
|
|
|
- - do:
|
|
|
- index:
|
|
|
- index: my_ds
|
|
|
- body: { "foo": "bar4", "@timestamp": "2021-08-04" }
|
|
|
- refresh: true
|
|
|
-
|
|
|
-
|
|
|
- # test that segments are sorted by @timestamp DESC in the new backing index,
|
|
|
- # as the newly created index and shard pick up the index leaf sorter
|
|
|
- - do:
|
|
|
- search:
|
|
|
- index: $idx0name
|
|
|
- body:
|
|
|
- fields: [{ "field":"@timestamp", "format":"yyyy-MM-dd" }]
|
|
|
- - match: { hits.total.value: 2 }
|
|
|
- - match: { hits.hits.0.fields.@timestamp: ["2021-08-04"] }
|
|
|
- - match: { hits.hits.1.fields.@timestamp: ["2021-08-03"] }
|
|
|
-
|
|
|
-
|
|
|
- - do:
|
|
|
- indices.delete_data_stream:
|
|
|
- name: my_ds
|
|
|
- - is_true: acknowledged
|