Framework integration
/
Rails
/
Advanced
Oct 21, 2024
Advanced usage
Sometimes it can be necessary 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:
Copy
1
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.
Copy
1
2
index_name = Contact.index_name
# client..get_settings(index_name), ...
Did you find this page helpful?