-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
When security is enabled (xpack.security.enabled: true and license is non basic) Indices requests with wildcard patterns might touch closed indices and throw. This happens if the wildcard (incl _all) includes an alias (that is authorized for the user) and the alias points to a closed index.
For example
PUT /foo
{
"settings": {
"number_of_replicas": 0,
"number_of_shards": 1
},
"aliases": {
"bar": {}
}
}
POST /foo/_close
GET /_stats
IndexClosedException[closed]
org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndices(IndexNameExpressionResolver.java:216)
org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:138)
org.elasticsearch.cluster.metadata.IndexNameExpressionResolver.concreteIndexNames(IndexNameExpressionResolver.java:71)
org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction$AsyncAction.<init>(TransportBroadcastByNodeAction.java:253)
org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction.doExecute(TransportBroadcastByNodeAction.java:226)
The writing is on the wall #31520 (comment)
and
Line 420 in 5afcbb8
| //TODO investigate supporting expandWildcards option for aliases too, like es core does. |
In detail, when security is enable it will pre-expand wildcards to indices and aliases that are authorized for the user. When expanding indices it's simple to check and not expand to closed indices. However an authorized alias can point to closed and open indices.
I think the root problem is that when we expand wildcards to concrete aliases it comes to the core as if the user specifically requested this alias, when in fact it requested a wildcard, which the core will otherwise gracefully expand only to the open indices.