Package org.elasticsearch.transport
Class RemoteClusterService
java.lang.Object
org.elasticsearch.transport.RemoteClusterAware
org.elasticsearch.transport.RemoteClusterService
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public final class RemoteClusterService extends RemoteClusterAware implements java.io.Closeable
Basic service for accessing remote clusters via gateway nodes
-
Field Summary
Fields inherited from class org.elasticsearch.transport.RemoteClusterAware
LOCAL_CLUSTER_GROUP_KEY, REMOTE_CLUSTER_INDEX_SEPARATOR, settings -
Method Summary
Modifier and Type Method Description voidclose()voidcollectNodes(java.util.Set<java.lang.String> clusters, ActionListener<java.util.function.BiFunction<java.lang.String,java.lang.String,DiscoveryNode>> listener)Collects all nodes of the given clusters and returns / passes a (clusterAlias, nodeId) toDiscoveryNodefunction on success.Transport.ConnectiongetConnection(java.lang.String cluster)Transport.ConnectiongetConnection(DiscoveryNode node, java.lang.String cluster)Returns a connection to the given node on the given remote clusterjava.util.Set<java.lang.String>getRegisteredRemoteClusterNames()Returns the registered remote cluster names.ClientgetRemoteClusterClient(ThreadPool threadPool, java.lang.String clusterAlias)Returns a client to the remote cluster if the given cluster alias exists.java.util.stream.Stream<RemoteConnectionInfo>getRemoteConnectionInfos()java.util.Map<java.lang.String,OriginalIndices>groupIndices(IndicesOptions indicesOptions, java.lang.String[] indices, java.util.function.Predicate<java.lang.String> indexExists)booleanisCrossClusterSearchEnabled()Returnstrueif at least one remote cluster is configuredbooleanisEnabled()booleanisSkipUnavailable(java.lang.String clusterAlias)Returns whether the cluster identified by the provided alias is configured to be skipped when unavailablevoidlistenForUpdates(ClusterSettings clusterSettings)Registers this instance to listen to updates on the cluster settings.protected voidupdateRemoteCluster(java.lang.String clusterAlias, Settings settings)Subclasses must implement this to receive information about updated cluster aliases.Methods inherited from class org.elasticsearch.transport.RemoteClusterAware
buildRemoteIndexName, getEnabledRemoteClusters, groupClusterIndices
-
Field Details
-
SEARCH_REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
-
REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
The initial connect timeout for remote cluster connections -
SEARCH_REMOTE_NODE_ATTRIBUTE
-
REMOTE_NODE_ATTRIBUTE
The name of a node attribute to select nodes that should be connected to in the remote cluster. For instance a node can be configured withnode.attr.gateway: truein order to be eligible as a gateway node between clusters. In that casesearch.remote.node.attr: gatewaycan be used to filter out other nodes in the remote cluster. The value of the setting is expected to be a boolean,truefor nodes that can become gateways,falseotherwise. -
SEARCH_ENABLE_REMOTE_CLUSTERS
-
ENABLE_REMOTE_CLUSTERS
Iftrueconnecting to remote clusters is supported on this node. Iffalsethis node will not establish connections to any remote clusters configured. Search requests executed against this node (where this node is the coordinating node) will fail if remote cluster syntax is used as an index pattern. The default istrue -
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE
-
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER
public static final SettingUpgrader<java.lang.Boolean> SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER -
REMOTE_CLUSTER_SKIP_UNAVAILABLE
-
REMOTE_CLUSTER_PING_SCHEDULE
-
REMOTE_CLUSTER_COMPRESS
-
-
Method Details
-
isEnabled
public boolean isEnabled() -
isCrossClusterSearchEnabled
public boolean isCrossClusterSearchEnabled()Returnstrueif at least one remote cluster is configured -
groupIndices
public java.util.Map<java.lang.String,OriginalIndices> groupIndices(IndicesOptions indicesOptions, java.lang.String[] indices, java.util.function.Predicate<java.lang.String> indexExists) -
getRegisteredRemoteClusterNames
public java.util.Set<java.lang.String> getRegisteredRemoteClusterNames()Returns the registered remote cluster names. -
getConnection
Returns a connection to the given node on the given remote cluster- Throws:
java.lang.IllegalArgumentException- if the remote cluster is unknown
-
isSkipUnavailable
public boolean isSkipUnavailable(java.lang.String clusterAlias)Returns whether the cluster identified by the provided alias is configured to be skipped when unavailable -
getConnection
-
listenForUpdates
Description copied from class:RemoteClusterAwareRegisters this instance to listen to updates on the cluster settings.- Overrides:
listenForUpdatesin classRemoteClusterAware
-
updateRemoteCluster
Description copied from class:RemoteClusterAwareSubclasses must implement this to receive information about updated cluster aliases.- Specified by:
updateRemoteClusterin classRemoteClusterAware
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
getRemoteConnectionInfos
-
collectNodes
public void collectNodes(java.util.Set<java.lang.String> clusters, ActionListener<java.util.function.BiFunction<java.lang.String,java.lang.String,DiscoveryNode>> listener)Collects all nodes of the given clusters and returns / passes a (clusterAlias, nodeId) toDiscoveryNodefunction on success. -
getRemoteClusterClient
Returns a client to the remote cluster if the given cluster alias exists.- Parameters:
threadPool- theThreadPoolfor the clientclusterAlias- the cluster alias the remote cluster is registered under- Throws:
java.lang.IllegalArgumentException- if the given clusterAlias doesn't exist
-