Data stream support for search shards API (#58486) (#58765)

This commit is contained in:
Dan Hermann 2020-06-30 17:59:51 -05:00 committed by GitHub
parent 40850a780d
commit 1c2a726731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 2 deletions

View File

@ -99,3 +99,41 @@
- match: { shards.0.0.index: test_index }
- match: { indices.test_index.aliases: [test_alias_no_filter]}
- is_false: indices.test_index.filter
---
"Search shards on data streams":
- skip:
features: allowed_warnings
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"
- 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
- do:
search_shards:
index: "simple-data-stream1"
- match: { shards.0.0.index: ".ds-simple-data-stream1-000001" }
- do:
indices.delete_data_stream:
name: simple-data-stream1
- is_true: acknowledged

View File

@ -392,6 +392,7 @@ public class DataStreamIT extends ESIntegTestCase {
verifyResolvability(dataStreamName, client().admin().cluster().prepareState().setIndices(dataStreamName), false);
verifyResolvability(dataStreamName, client().prepareFieldCaps(dataStreamName).setFields("*"), false);
verifyResolvability(dataStreamName, client().admin().indices().prepareGetIndex().addIndices(dataStreamName), false);
verifyResolvability(dataStreamName, client().admin().cluster().prepareSearchShards(dataStreamName), false);
verifyResolvability(dataStreamName, client().admin().indices().prepareOpen(dataStreamName), false);
request = new CreateDataStreamAction.Request("logs-barbaz");
@ -422,6 +423,7 @@ public class DataStreamIT extends ESIntegTestCase {
verifyResolvability(wildcardExpression, client().admin().cluster().prepareState().setIndices(wildcardExpression), false);
verifyResolvability(wildcardExpression, client().prepareFieldCaps(wildcardExpression).setFields("*"), false);
verifyResolvability(wildcardExpression, client().admin().indices().prepareGetIndex().addIndices(wildcardExpression), false);
verifyResolvability(wildcardExpression, client().admin().cluster().prepareSearchShards(wildcardExpression), false);
verifyResolvability(wildcardExpression, client().admin().indices().prepareOpen(wildcardExpression), false);
}

View File

@ -68,7 +68,7 @@ public class TransportClusterSearchShardsAction extends
@Override
protected ClusterBlockException checkBlock(ClusterSearchShardsRequest request, ClusterState state) {
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_READ,
indexNameExpressionResolver.concreteIndexNames(state, request));
indexNameExpressionResolver.concreteIndexNames(state, request, true));
}
@Override
@ -80,7 +80,7 @@ public class TransportClusterSearchShardsAction extends
protected void masterOperation(final ClusterSearchShardsRequest request, final ClusterState state,
final ActionListener<ClusterSearchShardsResponse> listener) {
ClusterState clusterState = clusterService.state();
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request);
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request, true);
Map<String, Set<String>> routingMap = indexNameExpressionResolver.resolveSearchRouting(state, request.routing(), request.indices());
Map<String, AliasFilter> indicesAndFilters = new HashMap<>();
Set<String> indicesAndAliases = indexNameExpressionResolver.resolveExpressions(clusterState, request.indices());