Cross-Cluster Search: Federated Queries Across Multiple Elasticsearch Clusters
AI generated
_doc
_index
Elasticsearch / Distributed Architecture
Cross-Cluster Search
federated queries across multiple clusters

As a company grows across multiple regions or brands, several independent Elasticsearch clusters often end up running side by side, each operated, scaled, and upgraded on its own. Cross-cluster search lets a single query run across the boundaries of those separate clusters without first merging the data into one shared cluster. For operators of several regionally separate Magento instances, each with its own search index, that means being able to offer a central, company-wide search without giving up the existing, deliberately separated cluster topology. How remote cluster configuration works in detail, what latency and consistency trade-offs come with it, and where the practical limits sit determine whether cross-cluster search is genuinely the right fit for a given use case.

11 min read Sniff and proxy mode Regional store clusters Cross-cluster API keys

1. What cross-cluster search is and what it's for

Cross-cluster search, CCS for short, lets a coordinating cluster run a search request not only against its own, local indices but simultaneously against indices on one or more clusters registered as remote. From the requesting client's point of view, the result looks like a single, merged response, even though the underlying data physically lives on completely separate cluster installations, each managing its own master elections, shard distribution, and version upgrades independently.

The central use case is federated search across organizationally or geographically separate data sets, without having to consolidate them into one single, shared cluster. That matters most when regulatory requirements demand physical data separation by region, while a company-wide overview is still desired at the same time.

2. Remote cluster configuration: sniff and proxy mode

A remote cluster gets registered via the cluster settings API or directly in elasticsearch.yml, with two connection modes to choose from. In sniff mode, the coordinating cluster first connects to one or more specified seed nodes and automatically discovers additional nodes in the remote cluster that are suitable for cross-cluster requests.

In proxy mode, on the other hand, all communication runs through a single, configured address, typically a load balancer or reverse proxy sitting in front of the remote cluster, which removes the need for direct network visibility into individual node addresses of the remote cluster. For setups with strict network segmentation between regions, proxy mode is usually the more practical choice.


PUT _cluster/settings
{
  "persistent": {
    "cluster.remote": {
      "us_cluster": {
        "mode": "proxy",
        "proxy_address": "us-es-proxy.internal:9443"
      },
      "eu_cluster": {
        "mode": "sniff",
        "seeds": [ "eu-es-node-01.internal:9300" ]
      }
    }
  }
}

3. Executing a cross-cluster query: structure and syntax

A cross-cluster request barely differs syntactically from an ordinary search request, the index name simply gets extended with the cluster alias and a colon, for instance eu_cluster:products or us_cluster:products. Multiple clusters and local indices can be combined in the same request, so a single search call searches both local and remote data at once.

Internally, the coordinating cluster splits the request into sub-requests per cluster, sends them in parallel to the respective remote clusters, and then merges the returning partial results into one combined, relevance-sorted result list, exactly like merging shard results within a single cluster.


GET eu_cluster:products,us_cluster:products,products/_search
{
  "query": {
    "match": { "name": "hiking boots" }
  },
  "size": 20
}

4. Latency trade-offs of distributed queries

Every cross-cluster request is fundamentally as slow as the slowest remote cluster involved, since the coordinating cluster has to wait for responses from every queried cluster before it can return the combined result. Between geographically distant clusters, for instance between Europe and the US, sheer network round-trip time alone adds noticeably to the actual search time.

The minimize roundtrips parameter reduces the number of network round trips by letting more processing happen on the remote clusters themselves, but it only reduces latency to a limited extent between far-apart clusters. For latency-critical, company-wide search requests, it's realistic to expect a noticeably higher response time than with a purely local search.

5. Consistency limits: no global read consistency model

Cross-cluster search offers no global, cross-cluster consistency guarantee. Every involved cluster returns its result based on its own local state at the time of the request, with no cross-cluster synchronization happening between them. If a document changes in a remote cluster exactly while a cross-cluster request is running, that can result in an inconsistent snapshot.

For most search use cases, this behavior is uncritical, since search rarely requires transactional consistency anyway. For use cases that depend on exact, immediately consistent numbers, for instance real-time stock queries, cross-cluster search should not serve as the sole data source.

6. Security: cross-cluster API keys and permissions

For production setups, a cross-cluster API key is preferable to the classic certificate-based remote cluster connection, since it can be scoped precisely to individual indices and permissions on the remote cluster. That way, the coordinating cluster only gets access to exactly the indices meant to be exposed for federated search, not to the entire remote cluster.

This granular permission model matters especially when separate teams operate the involved clusters independently, for instance different regional Magento instances with their own operational owners. A tightly scoped API key prevents a central search integration from accidentally gaining access to indices that were never meant to be part of the company-wide search.


POST /_security/cross_cluster/api_key
{
  "name": "central-search-eu-cluster",
  "access": {
    "search": [
      { "names": [ "products*" ], "allow_restricted_indices": false }
    ]
  }
}

7. Practical use case: regionally separate store clusters with central search

A retailer runs a separate, independent Elasticsearch cluster for each of its Magento instances in Germany, France, and the US, partly for latency reasons but also because of regulatory requirements around data residency. For an internal team that needs a company-wide view of product availability and search trends, fully consolidating the data into one shared cluster would be disproportionately expensive and would undercut the existing regional separation.

Cross-cluster search solves exactly this problem: a central, internal analytics tool registers all three regional clusters as remote clusters and can run a combined search across all three product catalogs through them, while each regional Magento instance itself keeps searching exclusively against its own local cluster, unaffected by the extra cross-cluster load.

8. Skip unavailable and error handling for unreachable clusters

If a registered remote cluster is unreachable at the time of a request, the skip_unavailable setting decides, per cluster, how the overall request behaves. If it's set to true, the request still returns a result built from the reachable clusters, supplemented with a note about the skipped cluster, instead of failing outright.

If skip_unavailable is set to false, the default, the entire request fails as soon as even a single involved cluster is unreachable. For a company-wide search where a single, temporarily unreachable regional cluster shouldn't take down the whole feature, setting it to true is the more robust choice in most cases.

9. Limits, and when cross-cluster search isn't worth it

Cross-cluster search is no substitute for data consolidation when a genuinely shared, consistent data basis with uniform relevance scoring across all regions is required, for instance because different clusters use slightly different mapping or analyzer configurations, which makes scores not directly comparable.

For very latency-critical, frequently repeated requests, for instance live search directly in the storefront, cross-cluster search is rarely the right choice either, because the extra network round-trip time between clusters becomes noticeable. For internal, less frequently run, company-wide evaluations and reports, the approach is well suited, without giving up the operational separation of the regional clusters.

Aspect Local search Cross-cluster search Practical relevance
Data storage One shared cluster Several independent clusters Preserves existing regional separation
Latency Local network round trip only Extra time up to the slowest remote cluster Not suited for very latency-critical live search
Consistency Uniform cluster state Independent snapshot per cluster Not suited for exact real-time stock levels
Permissions One uniform role model Scoped cross-cluster API keys per cluster Allows separate team ownership
Typical use Storefront search Company-wide reports and analytics A complement, not a replacement for local search

Mironsoft

Search index setup, relevance tuning, and Magento search

Magento search that shows the wrong products first?

We set up Elasticsearch or OpenSearch for Magento cleanly, tune relevance and facets to the actual catalog, and optimize indexing processes for large catalogs.

Relevance Tuning

Match search results and facets to actual customer needs.

Search Migration

Guide a clean migration from Solr or MySQL search to Elasticsearch/OpenSearch.

Index Performance

Make indexing processes for large catalogs reliable and performant.

10. Summary

Cross-Cluster Search: The Essentials at a Glance

Core idea

Cross-cluster search runs a query across several independent, remote-registered clusters without physically consolidating the data.

Connection modes

Sniff mode discovers remote nodes automatically via seed nodes, proxy mode runs through a single central address and suits segmented networks better.

Trade-offs

Latency is bound by the slowest involved cluster, and no global, cross-cluster consistency guarantee exists.

Practical relevance

Well suited for company-wide reports over regionally separate store clusters, less suited for very latency-critical live search in the storefront.

11. FAQ: Cross-Cluster Search: The Essentials at a Glance

1What's the difference between cross-cluster search and cross-cluster replication?
Cross-cluster search runs live queries across multiple clusters, while cross-cluster replication permanently synchronizes data from a leader cluster to a follower cluster.
2How does a remote cluster get registered?
Via the cluster settings API or elasticsearch.yml, specifying a cluster alias plus either seed nodes in sniff mode or a proxy address in proxy mode.
3How does sniff mode differ from proxy mode?
Sniff mode discovers remote nodes automatically via specified seed nodes, proxy mode routes all communication through a single, configured address.
4What does the syntax for a cross-cluster request look like?
The index name gets extended with the cluster alias and a colon, for instance eu_cluster:products, and multiple clusters can be combined in one request.
5Does cross-cluster search offer a global consistency guarantee?
No, every involved cluster returns its result based on its own local state, with no cross-cluster synchronization.
6How is access to remote clusters secured?
Via cross-cluster API keys, which can be scoped precisely to individual indices and permissions on the remote cluster.
7What happens if a remote cluster is unreachable?
The skip_unavailable setting decides, per cluster, whether the overall request continues with a partial result or fails outright.
8Which use case suits cross-cluster search particularly well for Magento stores?
Company-wide evaluations across regionally separate store clusters, without giving up the existing regional data separation.
9Why is cross-cluster search usually unsuitable for live search in the storefront?
Because the extra network round-trip time to the slowest involved cluster noticeably increases response time.
10Can relevance scores be compared directly across different clusters?
Only to a limited extent, since different mapping or analyzer configurations between clusters can produce scores that aren't directly comparable.