Skip to main content
Once your sharded cluster is set up, you can modify the topology without restarting instances. All topology changes go through PATCH /network on the leader instance.

Add a remote

Include the new remote in the remotes object. Remotes not present in the request are left unchanged:
curl \
  -X PATCH 'MEILISEARCH_URL/network' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "remotes": {
      "ms-03": {
        "url": "http://ms-03.example.com:7703",
        "searchApiKey": "SEARCH_KEY_03",
        "writeApiKey": "WRITE_KEY_03"
      }
    },
    "shards": {
      "shard-a": { "addRemotes": ["ms-03"] }
    }
  }'
You can use addRemotes inside a shard definition to add the new remote to an existing shard without rewriting the full shard assignment.

Remove a remote

Set a remote to null to remove it from the network. This also removes the remote from all shard assignments:
curl \
  -X PATCH 'MEILISEARCH_URL/network' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "remotes": {
      "ms-03": null
    }
  }'
When a remote is removed, Meilisearch triggers a NetworkTopologyChange task that rebalances documents across the remaining remotes.
The removed instance still retains its local data after being removed from the network. It is no longer part of the cluster and will not receive new documents or participate in searches.

Update shard assignments

You can also use removeRemotes inside a shard definition to remove a remote from a specific shard. To fully replace the shard assignment, send a new shards configuration with the remotes list:
curl \
  -X PATCH 'MEILISEARCH_URL/network' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "shards": {
      "shard-a": { "remotes": ["ms-00", "ms-01", "ms-03"] },
      "shard-b": { "remotes": ["ms-01", "ms-02"] },
      "shard-c": { "remotes": ["ms-02", "ms-03"] }
    }
  }'

Filter searches by shard

Target specific shards using the _shard filter in search requests:
curl \
  -X POST 'MEILISEARCH_URL/indexes/movies/search' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "q": "batman",
    "useNetwork": true,
    "filter": "_shard = \"shard-a\""
  }'
Supported _shard filter operators:
SyntaxBehavior
_shard = "shard-a"Results from shard-a only
_shard != "shard-a"Results from all shards except shard-a
_shard IN ["shard-a", "shard-b"]Results from 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:
meilisearch --experimental-allowed-ip-networks 10.0.0.0/8,192.168.0.0/16
Only allow the CIDR ranges your instances actually use.

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.