Adds GraphExploreRequest as a remote index request (elastic/x-pack-elasticsearch#1836)

The graph API needs to be able to search in remote indices. Although it uses the Search API to perform the search and so doesn’t need to deal with remote indexes directly, the security feature needs to know it can be used with remote indexes so it knows to include remote indices in the list of indices accessible from the API for index level security

Original commit: elastic/x-pack-elasticsearch@e3cd84963e
This commit is contained in:
Colin Goodheart-Smithe 2017-06-26 09:59:00 +01:00 committed by GitHub
parent a73be456ec
commit 27aa3094f6
2 changed files with 7 additions and 2 deletions

View File

@ -37,6 +37,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexNotFoundException;
import org.elasticsearch.transport.RemoteClusterAware;
import org.elasticsearch.transport.TransportRequest;
import org.elasticsearch.xpack.graph.action.GraphExploreRequest;
public class IndicesAndAliasesResolver {
@ -213,7 +214,8 @@ public class IndicesAndAliasesResolver {
}
public static boolean allowsRemoteIndices(IndicesRequest request) {
return request instanceof SearchRequest || request instanceof FieldCapabilitiesRequest;
return request instanceof SearchRequest || request instanceof FieldCapabilitiesRequest
|| request instanceof GraphExploreRequest;
}
private List<String> loadAuthorizedAliases(List<String> authorizedIndices, MetaData metaData) {

View File

@ -55,6 +55,8 @@ import org.elasticsearch.search.internal.ShardSearchTransportRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportRequest;
import org.elasticsearch.xpack.graph.action.GraphExploreAction;
import org.elasticsearch.xpack.graph.action.GraphExploreRequest;
import org.elasticsearch.xpack.security.SecurityLifecycleService;
import org.elasticsearch.xpack.security.audit.AuditTrailService;
import org.elasticsearch.xpack.security.authc.DefaultAuthenticationFailureHandler;
@ -1104,7 +1106,8 @@ public class IndicesAndAliasesResolverTests extends ESTestCase {
IndicesOptions options = IndicesOptions.fromOptions(true, false, false, false);
Tuple<TransportRequest, String> tuple = randomFrom(
new Tuple<>(new SearchRequest("remote:foo").indicesOptions(options), SearchAction.NAME),
new Tuple<>(new FieldCapabilitiesRequest().indices("remote:foo").indicesOptions(options), FieldCapabilitiesAction.NAME)
new Tuple<>(new FieldCapabilitiesRequest().indices("remote:foo").indicesOptions(options), FieldCapabilitiesAction.NAME),
new Tuple<>(new GraphExploreRequest().indices("remote:foo").indicesOptions(options), GraphExploreAction.NAME)
);
final TransportRequest request = tuple.v1();
ResolvedIndices resolved = resolveIndices(request, buildAuthorizedIndices(user, tuple.v2()));