Integrations / Frameworks / Rails / Advanced Usage
Mar. 18, 2019

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.

1
key = ::Algolia.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).

1
2
index = Contact.index
# index.get_settings, index.partial_update_object, ...

Did you find this page helpful?