Indexing Discourse in Algolia with group permissions

Dear Algolia-team and users,

Within our company we’re implementing a Discourse environment, backed with Algolia to make searching through documentation a whole lot more awesome. From here, we also want to index Discourse posts/topics in Algolia to also make this lightning fast.

We’ve come across your plugin on Github to do this ( and made some adjustments to fit our needs. Saving everything to Algolia seems to work well.

As you can imagine, in a corporate setting you might want to expose some forums to certain groups and do the opposite to other groups. I am wondering whether there are any suggestions on how we could/should achieve this.

When going through the Algolia documentation, we could generate a search API key for each user and update each post/topic with a list of users who can see a post, but this seems very annoying to do, since everytime permissions of a user gets updated, you would have to re-generate everything. Also you would need to save the search API key serverside and send it to the frontend for the search-form.

I’m kind of hoping someone has already come across this or can help us figure out how we should implement this.



Hi @Arjen,

Thanks for asking the question here. Great that you’re looking at using Algolia for your Discourse, we’d love to have you as a user.

Right now, the plugin does not do much for group-level security, so what is indexed and searchable is just the perspective of a single user. It is possible though using secured API keys.

For secured API keys, you can generated them on the fly based on the current list of categories the user has access to. So you could restrict them from see seeing results from a particular category in an indexed Discourse post. As long as your user object updates when their permissions change, you would be pushing a new key out to the front-end that would have the right access.

Let me know if you have questions about that work and we can discuss.


Hi there, was wondering if you already have more access restriction possibilities. We will setup a community on Discourse and we will need to have various access levels. Could you explain me what the options are? Thanks in advance!