Use the /network route to create a network of Meilisearch instances. This is particularly useful when used together with federated search to implement horizontal database partition strategies such as sharding.
This is an experimental feature. Use the Meilisearch Cloud UI or the experimental features endpoint to activate it:
curl \
  -X PATCH 'MEILISEARCH_URL/experimental-features/' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "network": true
  }'
If an attribute is both:
  • not on the displayedAttributes list
  • present on the sortableAttributes
It is possible its value becomes publicly accessible via the /network endpoint.Do not enable the network feature if you rely on the value of attributes not present in displayedAttributes to remain hidden at all times.

The network object

{
  "self": "ms-00",
  "sharding": false,
  "remotes": {
    "ms-00": {
      "url": "http://ms-1235.example.meilisearch.io",
      "searchApiKey": "Ecd1SDDi4pqdJD6qYLxD3y7VZAEb4d9j6LJgt4d6xas",
      "writeApiKey": "O2OaIHgwGuHNx9duH6kSe1YJ55Bh0dXvLhbr8FQVvr3vRVViBO"
    },
    "ms-01": {
      "url": "http://ms-4242.example.meilisearch.io",
      "searchApiKey": "hrVu-OMcjPGElK7692K7bwriBoGyHXTMvB5NmZkMKqQ",
      "writeApiKey": "bd1ldDoFlfyeoFDe8f3GVNiE8AHX86chmFuzOW7nWYUbPa7ww3"
    }
  }
}

self

Type: String
Default value: null
Description: A string indicating the name of the current instance

sharding

Type: Boolean
Default value: false
Description: A boolean indicating whether sharding should be enabled on the network

remotes

Type: Object
Default value: {}
Description: An object containing remote objects. The key of each remote object indicates the name of the remote instance

The remote object

"ms-00": {
  "url": "http://ms-1235.example.meilisearch.io",
  "searchApiKey": "Ecd1SDDi4pqdJD6qYLxD3y7VZAEb4d9j6LJgt4d6xas",
  "writeApiKey": "O2OaIHgwGuHNx9duH6kSe1YJ55Bh0dXvLhbr8FQVvr3vRVViBO"
}
url
Type: String
Default value: null
Description: URL indicating the address of a Meilisearch instance. This URL does not need to be public, but must be accessible to all instances in the network. Required
searchApiKey
Type: String
Default value: null
Description: An API key with search permissions
writeApiKey
Type: String
Default value: null
Description: An API key with documents.* permissions

Get the network object

GET
/network
Returns the current value of the instance’s network object.

Example

curl \
  -X GET 'MEILISEARCH_URL/network'

Response: 200 Ok

{
  "self": "ms-00",
  "sharding": false,
  "remotes": {
    "ms-00": {
      "url": "http://ms-1235.example.meilisearch.io",
      "searchApiKey": "Ecd1SDDi4pqdJD6qYLxD3y7VZAEb4d9j6LJgt4d6xas",
      "writeApiKey": "O2OaIHgwGuHNx9duH6kSe1YJ55Bh0dXvLhbr8FQVvr3vRVViBO"
    },
    "ms-01": {
      "url": "http://ms-4242.example.meilisearch.io",
      "searchApiKey": "hrVu-OMcjPGElK7692K7bwriBoGyHXTMvB5NmZkMKqQ",
      "writeApiKey": "bd1ldDoFlfyeoFDe8f3GVNiE8AHX86chmFuzOW7nWYUbPa7ww3"
    }
  }
}

Update the network object

PATCH
/network
Update the self and remotes fields of the network object. Updates to the network object are partial. Only provide the fields you intend to update. Fields not present in the payload will remain unchanged. To reset self, sharding and remotes to their original value, set them to null. To remove a single remote from your network, set the value of its name to null.

Body

NameTypeDefault valueDescription
selfStringnullThe name of the current instance
shardingBooleanfalseWhether sharding should be enabled on the network
remotesStringnullA list of remote objects describing accessible Meilisearch instances

Example

curl \
  -X PATCH 'MEILISEARCH_URL/network' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "self": "ms-00",
    "remotes": {
      "ms-00": {
        "url": "http://INSTANCE_URL",
        "searchApiKey": "INSTANCE_API_KEY"
      },
      "ms-01": {
        "url": "http://ANOTHER_INSTANCE_URL",
        "searchApiKey": "ANOTHER_INSTANCE_API_KEY"
      }
    }
  }'

Response: 200 Ok

{
  "self": "ms-00",
  "sharding": true,
  "remotes": {
    "ms-00": {
      "url": "http://INSTANCE_URL",
      "searchApiKey": "INSTANCE_API_KEY",
      "writeApiKey": "INSTANCE_WRITE_API_KEY"
    },
    "ms-01": {
      "url": "http://ANOTHER_INSTANCE_URL",
      "searchApiKey": "ANOTHER_INSTANCE_API_KEY",
      "writeApiKey": "ANOTHER_INSTANCE_WRITE_API_KEY"
    }
  }
}