You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: resources/self_hosting/sharding/configure_replication.mdx
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Replication requires the Meilisearch Enterprise Edition v1.37 or later and a [co
12
12
13
13
## How replication works
14
14
15
-
When you configure shards, each shard can be assigned to one or more remotes. If a shard is assigned to multiple remotes, Meilisearch replicates the data to each of them. During a search with `useNetwork: true`, Meilisearch queries each shard exactly once, picking one of the available remotes for each shard. This avoids duplicate results.
15
+
When you configure shards, each shard can be assigned to one or more remotes. If a shard is assigned to multiple remotes, Meilisearch replicates the data to each of them. During a search, Meilisearch queries each shard exactly once, picking one of the available remotes for each shard (prioritizing the `self`/local remote). This avoids duplicate results.
16
16
17
17
## Assign shards to multiple remotes
18
18
@@ -83,15 +83,13 @@ Place replicas in different regions to reduce latency for geographically distrib
83
83
}
84
84
```
85
85
86
-
Route search requests to the closest cluster. Both regions hold all data, so either can serve a full result set.
86
+
Route search requests to the closest cluster. Both regions hold all data, so either can serve a full result set. By default, Meilisearch prioritizes local search requests and will not transfer the request to a remote server. Make sure your search requests are made on the closest remote instance to ensure this setup is efficient.
87
87
88
88
## Remote availability
89
89
90
-
When a network search runs, Meilisearch builds an internal partition: it assigns each shard to exactly one remote, then sends one query per remote with a shard filter. This guarantees no shard is queried twice and results are never duplicated.
90
+
When a network search runs, Meilisearch builds an internal set of remotes to query: it assigns each shard to a remote, then sends one query per remote with a shard filter. This guarantees that no shard is queried twice and that results are never duplicated.
91
91
92
-
The downside is that there is no automatic fallback. If the remote assigned to a shard is unreachable, that shard's results are missing from the response — Meilisearch does not retry using another replica that holds the same shard.
93
-
94
-
To handle remote failures, route search traffic away from unhealthy instances at the infrastructure level (for example, using a load balancer with health checks). When the failed remote comes back online, it can start serving searches again without manual intervention.
92
+
The downside is that there is no automatic fallback. If the remote assigned to a shard is unreachable, that shard's results are missing from the response — Meilisearch does not yet retry using another replica that holds the same shard.
95
93
96
94
## Scaling read throughput
97
95
@@ -130,8 +128,8 @@ The leader is responsible for all write operations (document additions, settings
130
128
131
129
If the leader goes down:
132
130
133
-
-**Search may be affected**: if search requests are routed to the downed leader, they will fail. Route search traffic to healthy instances using a load balancer
134
-
-**Writes are blocked**: no documents can be added or updated until a leader is available
131
+
-**Search may be affected**: if search requests are routed to the downed leader, they will fail
132
+
-**Writes are blocked**: no documents can be added or updated until a leader is available. Note that alive remote instances continue to process tasks
135
133
-**Manual promotion**: you must designate a new leader by updating the network topology with `PATCH /network` and setting `"leader"` to another instance
Copy file name to clipboardExpand all lines: resources/self_hosting/sharding/manage_network.mdx
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ curl \
89
89
90
90
When you modify shard assignments, Meilisearch triggers a `NetworkTopologyChange` task on all remotes. This task runs in three steps:
91
91
92
-
1.**Compute new shards**: each instance uses rendezvous hashing to determine which documents now belong to which shard under the new topology.
92
+
1.**Compute new shards**: each instance uses rendezvous hashing on document IDs to determine which documents belong to which shard under the new topology.
93
93
2.**Export and import**: documents are sent to remotes that now own them.
94
94
3.**Delete stale data**: once all remotes confirm their imports are complete, each instance deletes the documents it no longer owns. Search switches to the new shard definitions at this point.
Copy file name to clipboardExpand all lines: resources/self_hosting/sharding/overview.mdx
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,9 @@ graph TD
34
34
Any -->|merged results| Client
35
35
```
36
36
37
-
1.**Network**: the leader configures the topology via `/network` and propagates it to all remotes
38
-
2.**Shards**: the leader distributes document subsets across remotes based on shard assignments
39
-
3.**Search**: when `useNetwork: true` is set, the instance receiving the request fans out the search to all remotes, then merges and ranks the combined results
37
+
1.**Network**: the user configures the topology via `/network`on the leader, and this instance propagates it to all remotes
38
+
2.**Shards**: Remotes distribute the subsets of documents across themselves based on shard assignments
39
+
3.**Search**: when `useNetwork: true` is set or not defined (defaults to `true`), the instance receiving the request fans out the search to all remotes, then merges and ranks the combined results
40
40
41
41
## When to use sharding and replication
42
42
@@ -60,7 +60,11 @@ The leader instance is responsible for write operations and topology changes. No
60
60
61
61
## Searching across the network
62
62
63
-
To search across all instances, add `useNetwork: true` to your search request:
63
+
To search across all instances:
64
+
65
+
<Note>
66
+
`useNetwork` defaults to `true` when a network topology is defined.
67
+
</Note>
64
68
65
69
<CodeGroup>
66
70
@@ -70,8 +74,7 @@ curl \
70
74
-H 'Content-Type: application/json' \
71
75
-H 'Authorization: Bearer MEILISEARCH_KEY' \
72
76
--data-binary '{
73
-
"q": "batman",
74
-
"useNetwork": true
77
+
"q": "batman"
75
78
}'
76
79
```
77
80
@@ -82,7 +85,6 @@ The response includes `_federation` metadata showing which remote each result ca
@@ -119,7 +121,7 @@ Most Meilisearch features work transparently across a sharded network. The follo
119
121
| Faceted search | Partial | Facet distribution in search results works across remotes, but the `/facet-search` endpoint does not support `useNetwork`|
120
122
| Hybrid/semantic search | Yes | Each remote runs its own vector search, results merged |
121
123
| Geo search | Yes | Geographic filters and sorting work across remotes |
Copy file name to clipboardExpand all lines: resources/self_hosting/sharding/setup_sharded_cluster.mdx
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,16 +89,20 @@ curl \
89
89
}
90
90
},
91
91
"shards": {
92
-
"shard-a": { "remotes": ["ms-00", "ms-01"] },
93
-
"shard-b": { "remotes": ["ms-01", "ms-02"] },
94
-
"shard-c": { "remotes": ["ms-02", "ms-00"] }
92
+
"shard-a": { "remotes": ["ms-00"] },
93
+
"shard-b": { "remotes": ["ms-01"] },
94
+
"shard-c": { "remotes": ["ms-02"] }
95
95
}
96
96
}'
97
97
```
98
98
99
99
</CodeGroup>
100
100
101
-
In this configuration, each shard is replicated across two remotes. If any single instance goes down, all shard data still exists on another instance.
101
+
In this configuration, each shard lives on exactly one remote. Documents are distributed across all three instances, and each instance handles searches for its own shards.
102
+
103
+
<Note>
104
+
This setup has no replication. If a remote becomes unavailable, its shards are missing from search results — Meilisearch does not yet automatically fall back to another instance. See [Configure replication](/resources/self_hosting/sharding/configure_replication) for a high-availability setup.
0 commit comments