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

Use addRemotes to add a new instance to the network without rewriting the entire remotes configuration:
curl \
  -X PATCH 'MEILISEARCH_URL/network' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "addRemotes": {
      "ms-03": {
        "url": "http://ms-03.example.com:7703",
        "searchApiKey": "SEARCH_KEY_03"
      }
    }
  }'
After adding the remote, update your shard configuration to assign shards to it.

Remove a remote

Use removeRemotes to take an instance out of the network:
curl \
  -X PATCH 'MEILISEARCH_URL/network' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "removeRemotes": ["ms-03"]
  }'
Before removing a remote, make sure its shards are replicated on other remotes. Removing the only remote holding a shard makes that data unavailable for network searches.

Update shard assignments

Reassign shards to different remotes by sending a new shards configuration:
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.