[7.x] Add data stream support to open index API (#58767)
This commit is contained in:
parent
22806c943d
commit
cae49b0fd7
|
@ -155,3 +155,72 @@
|
||||||
indices.delete_data_stream:
|
indices.delete_data_stream:
|
||||||
name: simple-data-stream1
|
name: simple-data-stream1
|
||||||
- is_true: acknowledged
|
- is_true: acknowledged
|
||||||
|
|
||||||
|
---
|
||||||
|
"Open write index for data stream opens all backing indices":
|
||||||
|
- skip:
|
||||||
|
version: " - 7.99.99"
|
||||||
|
reason: "change to - 7.8.99 after backport"
|
||||||
|
features: allowed_warnings
|
||||||
|
|
||||||
|
- do:
|
||||||
|
allowed_warnings:
|
||||||
|
- "index template [my-template1] has index patterns [simple-data-stream1] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template1] will take precedence during new index creation"
|
||||||
|
indices.put_index_template:
|
||||||
|
name: my-template1
|
||||||
|
body:
|
||||||
|
index_patterns: [simple-data-stream1]
|
||||||
|
template:
|
||||||
|
mappings:
|
||||||
|
properties:
|
||||||
|
'@timestamp':
|
||||||
|
type: date
|
||||||
|
data_stream:
|
||||||
|
timestamp_field: '@timestamp'
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.create_data_stream:
|
||||||
|
name: simple-data-stream1
|
||||||
|
- is_true: acknowledged
|
||||||
|
|
||||||
|
# rollover data stream twice to create new backing indices
|
||||||
|
- do:
|
||||||
|
indices.rollover:
|
||||||
|
alias: "simple-data-stream1"
|
||||||
|
|
||||||
|
- match: { old_index: .ds-simple-data-stream1-000001 }
|
||||||
|
- match: { new_index: .ds-simple-data-stream1-000002 }
|
||||||
|
- match: { rolled_over: true }
|
||||||
|
- match: { dry_run: false }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.rollover:
|
||||||
|
alias: "simple-data-stream1"
|
||||||
|
|
||||||
|
- match: { old_index: .ds-simple-data-stream1-000002 }
|
||||||
|
- match: { new_index: .ds-simple-data-stream1-000003 }
|
||||||
|
- match: { rolled_over: true }
|
||||||
|
- match: { dry_run: false }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.close:
|
||||||
|
index: ".ds-simple-data-stream1-000001,.ds-simple-data-stream1-000002"
|
||||||
|
- is_true: acknowledged
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.open:
|
||||||
|
index: simple-data-stream1
|
||||||
|
- is_true: acknowledged
|
||||||
|
|
||||||
|
# all closed backing indices should be re-opened and returned
|
||||||
|
- do:
|
||||||
|
indices.get:
|
||||||
|
index: ".ds-simple-data-stream1-*"
|
||||||
|
|
||||||
|
- is_true: \.ds-simple-data-stream1-000001.settings
|
||||||
|
- is_true: \.ds-simple-data-stream1-000002.settings
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.delete_data_stream:
|
||||||
|
name: simple-data-stream1
|
||||||
|
- is_true: acknowledged
|
||||||
|
|
|
@ -392,6 +392,7 @@ public class DataStreamIT extends ESIntegTestCase {
|
||||||
verifyResolvability(dataStreamName, client().admin().cluster().prepareState().setIndices(dataStreamName), false);
|
verifyResolvability(dataStreamName, client().admin().cluster().prepareState().setIndices(dataStreamName), false);
|
||||||
verifyResolvability(dataStreamName, client().prepareFieldCaps(dataStreamName).setFields("*"), false);
|
verifyResolvability(dataStreamName, client().prepareFieldCaps(dataStreamName).setFields("*"), false);
|
||||||
verifyResolvability(dataStreamName, client().admin().indices().prepareGetIndex().addIndices(dataStreamName), false);
|
verifyResolvability(dataStreamName, client().admin().indices().prepareGetIndex().addIndices(dataStreamName), false);
|
||||||
|
verifyResolvability(dataStreamName, client().admin().indices().prepareOpen(dataStreamName), false);
|
||||||
|
|
||||||
request = new CreateDataStreamAction.Request("logs-barbaz");
|
request = new CreateDataStreamAction.Request("logs-barbaz");
|
||||||
client().admin().indices().createDataStream(request).actionGet();
|
client().admin().indices().createDataStream(request).actionGet();
|
||||||
|
@ -421,6 +422,7 @@ public class DataStreamIT extends ESIntegTestCase {
|
||||||
verifyResolvability(wildcardExpression, client().admin().cluster().prepareState().setIndices(wildcardExpression), false);
|
verifyResolvability(wildcardExpression, client().admin().cluster().prepareState().setIndices(wildcardExpression), false);
|
||||||
verifyResolvability(wildcardExpression, client().prepareFieldCaps(wildcardExpression).setFields("*"), false);
|
verifyResolvability(wildcardExpression, client().prepareFieldCaps(wildcardExpression).setFields("*"), false);
|
||||||
verifyResolvability(wildcardExpression, client().admin().indices().prepareGetIndex().addIndices(wildcardExpression), false);
|
verifyResolvability(wildcardExpression, client().admin().indices().prepareGetIndex().addIndices(wildcardExpression), false);
|
||||||
|
verifyResolvability(wildcardExpression, client().admin().indices().prepareOpen(wildcardExpression), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCannotDeleteComposableTemplateUsedByDataStream() throws Exception {
|
public void testCannotDeleteComposableTemplateUsedByDataStream() throws Exception {
|
||||||
|
|
|
@ -83,13 +83,13 @@ public class TransportOpenIndexAction extends TransportMasterNodeAction<OpenInde
|
||||||
@Override
|
@Override
|
||||||
protected ClusterBlockException checkBlock(OpenIndexRequest request, ClusterState state) {
|
protected ClusterBlockException checkBlock(OpenIndexRequest request, ClusterState state) {
|
||||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_WRITE,
|
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_WRITE,
|
||||||
indexNameExpressionResolver.concreteIndexNames(state, request));
|
indexNameExpressionResolver.concreteIndexNames(state, request, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void masterOperation(final OpenIndexRequest request, final ClusterState state,
|
protected void masterOperation(final OpenIndexRequest request, final ClusterState state,
|
||||||
final ActionListener<OpenIndexResponse> listener) {
|
final ActionListener<OpenIndexResponse> listener) {
|
||||||
final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request);
|
final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request, true);
|
||||||
if (concreteIndices == null || concreteIndices.length == 0) {
|
if (concreteIndices == null || concreteIndices.length == 0) {
|
||||||
listener.onResponse(new OpenIndexResponse(true, true));
|
listener.onResponse(new OpenIndexResponse(true, true));
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue