mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
fix compile error due to changes in core with transport actions and MetaData
Original commit: elastic/x-pack-elasticsearch@5db2e18e31
This commit is contained in:
parent
9e36796126
commit
f71ba1f025
@ -11,6 +11,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.nodes.TransportNodesAction;
|
||||
import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.shield.authc.Realm;
|
||||
@ -32,9 +33,10 @@ public class TransportClearRealmCacheAction extends TransportNodesAction<ClearRe
|
||||
@Inject
|
||||
public TransportClearRealmCacheAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
|
||||
ClusterService clusterService, TransportService transportService,
|
||||
ActionFilters actionFilters, Realms realms) {
|
||||
ActionFilters actionFilters, Realms realms,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(settings, ClearRealmCacheAction.NAME, clusterName, threadPool, clusterService, transportService, actionFilters,
|
||||
ClearRealmCacheRequest.class, ClearRealmCacheRequest.Node.class, ThreadPool.Names.MANAGEMENT);
|
||||
indexNameExpressionResolver, ClearRealmCacheRequest.class, ClearRealmCacheRequest.Node.class, ThreadPool.Names.MANAGEMENT);
|
||||
this.realms = realms;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ import org.elasticsearch.action.CompositeIndicesRequest;
|
||||
import org.elasticsearch.action.IndicesRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.index.Index;
|
||||
@ -143,7 +144,7 @@ public class DefaultIndicesResolver implements IndicesResolver<TransportRequest>
|
||||
}
|
||||
|
||||
private boolean containsWildcards(IndicesRequest indicesRequest) {
|
||||
if (MetaData.isAllIndices(indicesRequest.indices())) {
|
||||
if (IndexNameExpressionResolver.isAllIndices(indicesList(indicesRequest.indices()))) {
|
||||
return true;
|
||||
}
|
||||
for (String index : indicesRequest.indices()) {
|
||||
@ -156,7 +157,7 @@ public class DefaultIndicesResolver implements IndicesResolver<TransportRequest>
|
||||
|
||||
private List<String> replaceWildcardsWithAuthorizedIndices(String[] indices, IndicesOptions indicesOptions, MetaData metaData, List<String> authorizedIndices) {
|
||||
|
||||
if (MetaData.isAllIndices(indices)) {
|
||||
if (IndexNameExpressionResolver.isAllIndices(indicesList(indices))) {
|
||||
List<String> visibleIndices = new ArrayList<>();
|
||||
for (String authorizedIndex : authorizedIndices) {
|
||||
if (isIndexVisible(authorizedIndex, indicesOptions, metaData)) {
|
||||
@ -225,7 +226,7 @@ public class DefaultIndicesResolver implements IndicesResolver<TransportRequest>
|
||||
//If we can't replace because we got an empty set, we can only throw exception.
|
||||
//Downside of this is that a single item exception is going to make fail the composite request that holds it as a whole.
|
||||
if (resolvedIndices == null || resolvedIndices.isEmpty()) {
|
||||
Index index = MetaData.isAllIndices(originalIndices) ? new Index(MetaData.ALL) : new Index(Arrays.toString(originalIndices));
|
||||
Index index = IndexNameExpressionResolver.isAllIndices(indicesList(originalIndices)) ? new Index(MetaData.ALL) : new Index(Arrays.toString(originalIndices));
|
||||
throw new IndexMissingException(index);
|
||||
}
|
||||
return resolvedIndices;
|
||||
@ -248,4 +249,8 @@ public class DefaultIndicesResolver implements IndicesResolver<TransportRequest>
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static List<String> indicesList(String[] list) {
|
||||
return (list == null) ? null : Arrays.asList(list);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user