Class RemoteClusterAware

java.lang.Object
org.elasticsearch.transport.RemoteClusterAware
Direct Known Subclasses:
RemoteClusterService

public abstract class RemoteClusterAware extends Object
Base class for all services and components that need up-to-date information about the registered remote clusters
  • Field Details

  • Constructor Details

    • RemoteClusterAware

      protected RemoteClusterAware(Settings settings)
      Creates a new RemoteClusterAware instance
      Parameters:
      settings - the nodes level settings
  • Method Details

    • getEnabledRemoteClusters

      protected static Set<String> getEnabledRemoteClusters(Settings settings)
      Returns remote clusters that are enabled in these settings
    • isRemoteIndexName

      public static boolean isRemoteIndexName(String indexExpression)
      Check whether the index expression represents remote index or not. The index name is assumed to be individual index (no commas) but can contain `-`, wildcards, datemath, remote cluster name and any other syntax permissible in index expression component.
    • parseClusterAlias

      public static String parseClusterAlias(String indexExpression)
      Parameters:
      indexExpression - expects a single index expression at a time (not a csv list of expression)
      Returns:
      cluster alias in the index expression. If none is present, returns RemoteClusterAware.LOCAL_CLUSTER_GROUP_KEY
    • splitIndexName

      public static String[] splitIndexName(String indexExpression)
      Split the index name into remote cluster alias and index name. The index expression is assumed to be individual index (no commas) but can contain `-`, wildcards, datemath, remote cluster name and any other syntax permissible in index expression component. There's no guarantee the components actually represent existing remote cluster or index, only rudimentary checks are done on the syntax.
    • groupClusterIndices

      protected Map<String,List<String>> groupClusterIndices(Set<String> remoteClusterNames, String[] requestIndices)
      Groups indices per cluster by splitting remote cluster-alias, index-name pairs on REMOTE_CLUSTER_INDEX_SEPARATOR. All indices per cluster are collected as a list in the returned map keyed by the cluster alias. Local indices are grouped under LOCAL_CLUSTER_GROUP_KEY. The returned map is mutable. This method supports excluding clusters by using the -cluster:* index expression. For example, if requestIndices is [blogs, *:blogs, -remote1:*] and *:blogs resolves to "remote1:blogs, remote2:blogs" the map returned by the function will not have the remote1 entry. It will have only {"":blogs, remote2:blogs}. The index for the excluded cluster must be '*' to clarify that the entire cluster should be removed. A wildcard in the "-" excludes notation is also allowed. For example, suppose there are three remote clusters, remote1, remote2, remote3, and this index expression is provided: blogs,rem*:blogs,-rem*1:*. That would successfully remove remote1 from the list of clusters to be included.
      Parameters:
      remoteClusterNames - the remote cluster names. If a clusterAlias is preceded by a minus sign that cluster will be excluded.
      requestIndices - the indices in the search request to filter
      Returns:
      a map of grouped remote and local indices
    • updateRemoteCluster

      protected abstract void updateRemoteCluster(String clusterAlias, Settings settings)
      Subclasses must implement this to receive information about updated cluster aliases.
    • listenForUpdates

      public void listenForUpdates(ClusterSettings clusterSettings)
      Registers this instance to listen to updates on the cluster settings.
    • buildRemoteIndexName

      public static String buildRemoteIndexName(String clusterAlias, String indexName)