How to reindex suggestion index manually with javascript API?


We use External Analytics to add suggestions manually from our administration interface via the Javascript API.

However, these suggestions only appear when the suggestion index linked to this external index is rebuilt.

The documentation of algolia is really poor on this subject, we do not know how many times per day the rebuild is performed, at what time, under what conditions?

And above all we have no way (at least I didn’t find easily in the documentation) to manually rebuild the index via the javascript API.

Can someone give me this information and tell me if it is possible to rebuild the index from the javascript API?

Thanks in advance

@auberdog welcome to the community!

We have some information about keeping the suggestions up to date here in our documentation, but the gist is that we rebuild the index every 24 hours or whenever you change your query suggestion settings (important for later).

As for triggering a rebuild via the API, since we don’t have a way for you to trigger a rebuild directly, we probably don’t have an exposed method in an API client to do this. I looked through the source code for our JavaScript API Client (stable as well as the new version) and didn’t see a way.

However, you can “trick” Algolia into reindexing the query suggestions if you send a change request for the query suggestion settings even if you don’t actually change anything.

You’ll find the methods for this exposed in the client-query-suggestions package – this is not present on the stable release, however:

const { querySuggestionsClient } = require('@algolia/client-query-suggestions')

const qsClient = querySuggestionsClient(
    '...', // App Id
    '...', // Admin API Key
    "us" // Region

const run = async () => {
    // Get the latest configuration
    const configuration = await qsClient.getConfig({
        indexName: 'testbase'

    // And re-apply it to trigger a re-index
    let result
    try {
        result = await qsClient.updateConfig({
            indexName: 'testbase',
            querySuggestionsIndexParam: configuration
    } catch (e) {

You can export the settings using the client as well to get your initial configuration using qsClient.getConfig(). Or, if you would prefer to use the REST API:

Happy to help further, let us know! Thanks!

Thank you for your answer.

For the moment we will not use your method which seems to us not very rigorous. We will see later if Algolia offers more functionalities concerning the management of suggestion indexes.