PATCH /network on the leader instance.
Add a remote
Include the new remote in theremotes object. To assign it to an existing shard, either send the full remotes list for that shard, or use addRemotes as a convenience to append without rewriting the full list:
addRemotes and removeRemotes are write-only convenience fields. They are applied on top of the existing shard configuration and are never returned by GET /network, which always returns the full remotes list for each shard.Update shard assignments
Each shard object in aPATCH /network request accepts three fields:
| Field | Type | Behavior |
|---|---|---|
remotes | array | Full replacement of the shard’s remote list |
addRemotes | array | Adds remotes to the existing list |
removeRemotes | array | Removes remotes from the existing list, applied after addRemotes |
remotes:
Topology changes and rebalancing
When you modify shard assignments, Meilisearch triggers aNetworkTopologyChange task on all remotes. This task runs in three steps:
- Compute new shards: each instance uses rendezvous hashing on document IDs to determine which documents belong to which shard under the new topology.
- Export and import: documents are sent to remotes that now own them.
- 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.
Validation
PATCH /network rejects requests with a 400 invalid_network_shards error in the following cases:
- The shard list would become empty after applying the patch
- A shard’s
remoteslist would become empty after applyingremoveRemotes - A shard references a remote that is not in the
remotesobject - A remote is removed from
remotesand this leaves a shard with no remotes
Filter searches by shard
Target specific shards using the_shard filter in search requests:
_shard filter operators:
| Syntax | Behavior |
|---|---|
_shard = "shard-a" | Documents associated to shard-a |
_shard != "shard-a" | Documents associated to all shards except shard-a |
_shard IN ["shard-a", "shard-b"] | Documents associated to both shard-a and shard-b |
Private network security
By default, Meilisearch blocks requests to non-global IP addresses. If your instances communicate over a private network, configure the--experimental-allowed-ip-networks flag on each instance:
Next steps
Replication and sharding overview
Understand the concepts behind sharding, replication, and network search.
Deployment overview
Deploy Meilisearch to production on various cloud providers.