Integrations
/
Frameworks
/
Rails
/
Advanced Usage
Apr. 13, 2021
Advanced Usage
Using the API client
You would typically need to use the Algolia client to perform API keys operations. The client is available as a singleton and will use the algolia credentials set in the Rails configuration.
Copy
1
key = AlgoliaSearch.client.add_api_key({ acl: ['search'], 'indexes': ['*_development', '*_development.tmp'] })
Using the Model underlying the index
If you want to access the index used by a model you can call the index
class method. This method will follow
your naming configuration (per environment settings or custom names for instance).
Copy
1
2
index = Contact.index
# index.get_settings, index.partial_update_object, ...