Allow a number of broadcast transport actions to resolve data streams#55726
Conversation
…tream By changing to the default indices options of BroadcastRequest the following apis can resolve data streams: flush, refresh (already supported data streams), force merge, clear indices cache, indices stats, segments, upgrade stats, upgrade, validate query, searchable snapshots stats, clear searchable snapshots cache and reload analyzers APIs. The following APIs extend BroadcastRequest but overwrite default indices options and therefor don't yet support data streams: recovery api This change also adds `strictIncludeDataStreamsExpand()` to `IndicesOptions` class. (an alternative to `strictExpand()`) This is because `InternalClusterInfoService` overwrites the default indices options for the indices stats call. Relates to elastic#53100
|
Pinging @elastic/es-core-features (:Core/Features/Data streams) |
danhermann
left a comment
There was a problem hiding this comment.
LGTM. Left one minor comment
| * @return indices option that requires every specified index to exist, expands wildcards to both open and closed | ||
| * indices and allows that no indices are resolved from wildcard expressions (not returning an error). |
There was a problem hiding this comment.
Maybe add that data streams are included to distinguish it from ::strictExpand()
…ty_BroadcastRequest
|
I think I am also a bit worried that we here are introducing support for data streams in a wide array of APIs without any tests for it. I think it would be better to tackle them one by one, changing the indices options in each specific request and adding the necessary tests for it? |
True and it doesn't support aliases and wildcard expressions too. The corresponding transport action uses the leader and follower indices as provided in the api. Which why this PR doesn't add data stream support to this api either. The
I've added tests for all the APIs that have a request that extends from |
to include data streams by default. If a wildcard expression (which is `*` here) matches a data stream but the indices options don't include data streams then an error is returned. This change was spawned of from elastic#55726 which changes the default indices options of the indices stats api. This will avoid cluster info service from failing to refresh the stats: ``` [2020-04-29T17:16:00,218][WARN ][o.e.c.InternalClusterInfoService] [runTask-0] Failed to execute IndicesStatsAction for ClusterInfoUpdateJob java.lang.IllegalArgumentException: The provided expression [[_all]] matches a data stream, specify the corresponding concrete indices instead. at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.dataStreamsNotSupportedException(IndexNameExpressionResolver.java:278) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver$WildcardExpressionResolver.resolve(IndexNameExpressionResolver.java:699) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndices(IndexNameExpressionResolver.java:159) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:138) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:71) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction$AsyncAction.<init>(TransportBroadcastByNodeAction.java:252) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction.doExecute(TransportBroadcastByNodeAction.java:225) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction.doExecute(TransportBroadcastByNodeAction.java:76) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:88) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.ActionFilter$Simple.apply(ActionFilter.java:53) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:86) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$apply$0(SecurityActionFilter.java:86) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$authorizeRequest$4(SecurityActionFilter.java:172) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authz.AuthorizationService.authorizeSystemUser(AuthorizationService.java:388) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authz.AuthorizationService.authorize(AuthorizationService.java:192) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.authorizeRequest(SecurityActionFilter.java:172) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$applyInternal$3(SecurityActionFilter.java:158) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$2(AuthenticationService.java:323) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$6(AuthenticationService.java:385) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:396) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:320) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:156) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.applyInternal(SecurityActionFilter.java:155) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.lambda$apply$1(SecurityActionFilter.java:92) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.core.security.SecurityContext.executeAsUser(SecurityContext.java:127) [x-pack-core-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.xpack.security.action.filter.SecurityActionFilter.apply(SecurityActionFilter.java:90) [x-pack-security-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:86) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:64) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.tasks.TaskManager.registerAndExecute(TaskManager.java:151) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.client.node.NodeClient.executeLocally(NodeClient.java:90) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.client.node.NodeClient.doExecute(NodeClient.java:79) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:380) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1210) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.stats(AbstractClient.java:1465) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] at org.elasticsearch.cluster.InternalClusterInfoService.updateIndicesStats(InternalClusterInfoService.java:264) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT] ```
|
About I think we should rather use an indicesOptions that does not support data streams. I think the investigation work you are doing will likely address this? I think the tests look fine (though the forget follower action is missing). Thanks for pointing that out. I wonder if I should review this now or wait until you concluded the experiment on extracting the data stream option? |
Yes, I think we should wait with this pr and see how #56034 unfolds. |
…ty_BroadcastRequest
|
I've updated this PR based on the changes that came with #56034. |
…elastic#55726) Change TransportBroadcastByNodeAction and TransportBroadcastReplicationAction to be able to resolve data streams by default. Implementations can change this ability. This change allows to following APIs to resolve data streams: flush, refresh (already supported data streams), force merge, clear indices cache, indices stats (already supported data streams), segments, upgrade stats, upgrade, validate query, searchable snapshots stats, clear searchable snapshots cache and reload analyzers APIs. Relates to elastic#53100
…#55726) (#56502) Change TransportBroadcastByNodeAction and TransportBroadcastReplicationAction to be able to resolve data streams by default. Implementations can change this ability. This change allows to following APIs to resolve data streams: flush, refresh (already supported data streams), force merge, clear indices cache, indices stats (already supported data streams), segments, upgrade stats, upgrade, validate query, searchable snapshots stats, clear searchable snapshots cache and reload analyzers APIs. Relates to #53100
Change
TransportBroadcastByNodeActionandTransportBroadcastReplicationActionto be able to resolve data streams by default. Implementations can change this ability.
This change allows to following APIs to resolve data streams: flush,
refresh (already supported data streams), force merge, clear indices cache,
indices stats, segments, upgrade stats, upgrade, validate query,
searchable snapshots stats, clear searchable snapshots cache and
reload analyzers APIs.
Relates to #53100