Skip to content
Clémentine Urquizar - curqui edited this page Jan 27, 2022 · 2 revisions

The Client constructor can take the following parameters:

  • url: the URL to reach the Meilisearch server.
  • api_key (optional): the API key to access the Meilisearch server.
  • options (optional): to set a custom timeout (default: 1s) or a maximum number of retries with max_retries (default: 0).

Here is the basic way to use the Client:

client = MeiliSearch::Client.new($URL, $API_KEY)

The default timeout is 1 second. You might need to increase this timeout to complete larger indexing requests:

MeiliSearch::Client.new($URL, $MASTER_KEY, timeout: 10)
# or
MeiliSearch::HTTPRequest.default_timeout(10)

To set a number of retries:

client = MeiliSearch::Client.new($URL, $MASTER_KEY, max_retries: 2)
Clone this wiki locally