Skip to main content
Sometimes you need to access the Algolia API client directly.

Access the Algolia API client

The client is available as a singleton and uses the Algolia credentials you added to your Rails configuration. For example, to get an index’s settings:
Ruby
key = AlgoliaSearch.client.get_settings("index_name")

Access model indices

To access the index used by a model, use the index_name class method and pass it as a variable to the API client. This method follows your naming configuration, such as per-environment settings or custom names.
Ruby
index_name = Contact.index_name
# client..get_settings(index_name), ...
⌘I