/** * Returns a client to the remote cluster if the given cluster alias exists. * @param threadPool the {@link ThreadPool} for the client * @param clusterAlias the cluster alias the remote cluster is registered under * * @throws IllegalArgumentException if the given clusterAlias doesn't exist */ public Client getRemoteClusterClient(ThreadPool threadPool, String clusterAlias) { if (transportService.getRemoteClusterService().getRemoteClusterNames().contains(clusterAlias) == false) { throw new IllegalArgumentException("unknown cluster alias [" + clusterAlias + "]"); } return new RemoteClusterAwareClient(settings, threadPool, transportService, clusterAlias); }
public Map<String, OriginalIndices> groupIndices(IndicesOptions indicesOptions, String[] indices, Predicate<String> indexExists) { Map<String, OriginalIndices> originalIndicesMap = new HashMap<>(); if (isCrossClusterSearchEnabled()) { final Map<String, List<String>> groupedIndices = groupClusterIndices(getRemoteClusterNames(), indices, indexExists); if (groupedIndices.isEmpty()) { //search on _all in the local cluster if neither local indices nor remote indices were specified originalIndicesMap.put(LOCAL_CLUSTER_GROUP_KEY, new OriginalIndices(Strings.EMPTY_ARRAY, indicesOptions)); } else { for (Map.Entry<String, List<String>> entry : groupedIndices.entrySet()) { String clusterAlias = entry.getKey(); List<String> originalIndices = entry.getValue(); originalIndicesMap.put(clusterAlias, new OriginalIndices(originalIndices.toArray(new String[originalIndices.size()]), indicesOptions)); } } } else { originalIndicesMap.put(LOCAL_CLUSTER_GROUP_KEY, new OriginalIndices(indices, indicesOptions)); } return originalIndicesMap; }
/** * Returns a client to the remote cluster if the given cluster alias exists. * @param threadPool the {@link ThreadPool} for the client * @param clusterAlias the cluster alias the remote cluster is registered under * * @throws IllegalArgumentException if the given clusterAlias doesn't exist */ public Client getRemoteClusterClient(ThreadPool threadPool, String clusterAlias) { if (transportService.getRemoteClusterService().getRemoteClusterNames().contains(clusterAlias) == false) { throw new IllegalArgumentException("unknown cluster alias [" + clusterAlias + "]"); } return new RemoteClusterAwareClient(settings, threadPool, transportService, clusterAlias); }
/** * Returns a client to the remote cluster if the given cluster alias exists. * @param threadPool the {@link ThreadPool} for the client * @param clusterAlias the cluster alias the remote cluster is registered under * * @throws IllegalArgumentException if the given clusterAlias doesn't exist */ public Client getRemoteClusterClient(ThreadPool threadPool, String clusterAlias) { if (transportService.getRemoteClusterService().getRemoteClusterNames().contains(clusterAlias) == false) { throw new IllegalArgumentException("unknown cluster alias [" + clusterAlias + "]"); } return new RemoteClusterAwareClient(settings, threadPool, transportService, clusterAlias); } }