Skip to content
Clémentine Urquizar edited this page Jan 25, 2021 · 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