Replication and sharding require the Meilisearch Enterprise Edition v1.37 or later. See Enterprise and Community editions for details.
What is sharding?
Sharding distributes documents from a single index across multiple Meilisearch instances, called “remotes.” Each remote holds one or more named shards containing a subset of your documents. When a user searches, Meilisearch queries all remotes in the network, collects results from each shard, and merges them into a single ranked response, as if the data lived on one machine.What is replication?
Replication assigns the same shard to more than one remote. This ensures your data is stored redundantly across instances. During a search, Meilisearch queries each shard exactly once by picking one of the available replicas, avoiding duplicate results.How it works
- Network: the leader configures the topology via
/networkand propagates it to all remotes - Shards: the leader distributes document subsets across remotes based on shard assignments
- Search: when
useNetwork: trueis set, the instance receiving the request fans out the search to all remotes, then merges and ranks the combined results
When to use sharding and replication
| Scenario | Solution |
|---|---|
| Dataset too large for a single instance | Sharding: split documents across multiple remotes |
| Need high availability | Replication: assign each shard to 2+ remotes |
| Geographic distribution | Sharding + replication: place remotes closer to users |
| Read throughput bottleneck | Replication: distribute search load across replicas |
The network
All instances in a Meilisearch network share a topology configuration that defines:self: the identity of the current instanceleader: the instance coordinating writes and topology changesremotes: all instances in the network with their URLs, search API keys, and write API keysshards: how document subsets are distributed across remotes
not_leader error. Search requests can be sent to any instance in the network.
Searching across the network
To search across all instances, adduseNetwork: true to your search request:
_federation metadata showing which remote each result came from. You can also use the _shard filter to target specific shards:
Network search with multi-search
Network search works with multi-search and federated search. AdduseNetwork: true to individual queries within a multi-search request:
Feature compatibility
Most Meilisearch features work transparently across a sharded network. The following table highlights important considerations:| Feature | Works with sharding? | Notes |
|---|---|---|
| Full-text search | Yes | Results merged and ranked across all remotes |
| Filtering and sorting | Yes | Filters applied on each remote before merging |
| Faceted search | Partial | Facet distribution in search results works across remotes, but the /facet-search endpoint does not support useNetwork |
| Distinct attribute | Yes | Requires Meilisearch v1.40 or later |
| Hybrid/semantic search | Yes | Each remote runs its own vector search, results merged |
| Geo search | Yes | Geographic filters and sorting work across remotes |
| Multi-search | Yes | Use useNetwork: true per query |
| Federated search | Yes | Federation merges results from both indexes and remotes |
| Analytics | Partial | Events are tracked on the instance that receives the search request |
| Tenant tokens | Yes | Token filters apply on each remote |
| Document operations | Leader only | Writes must go through the leader instance |
| Settings changes | Leader only | Settings updates must go through the leader |
| Conversational search | No | Chat completions do not support useNetwork |
Prerequisites
Before setting up sharding and replication, you need:- Meilisearch Enterprise Edition v1.37 or later on all instances
- A master key configured on each instance
- Network connectivity between all instances
- If using private networks (
10.x.x.x,192.168.x.x), the--experimental-allowed-ip-networksflag must be set on each instance
Next steps
Set up a sharded cluster
Step-by-step guide to configuring sharding and replication.
Configure replication
Set up replicated shards for high availability and read scaling.
Manage the network
Add and remove remotes, update shard assignments.
Enterprise Edition
Learn about the differences between Community and Enterprise editions.