Before you begin
Deleting an index removes that index and its records, rules, settings, and synonyms. It doesn’t remove the associated analytics data. Before you delete or clear an index, consider exporting its records and configuration to a create a backup. To run the API examples, install the latest API client. Use an API key with the permissions required by each method. Deleting or clearing an index requires thedeleteIndex permission.
Before running CLI commands, install and configure the Algolia CLI for the that contains your indices.
Delete indices in the Algolia dashboard
- Go to the Algolia dashboard and select your Algolia application.
- On the left sidebar, select Search.
- Select your Algolia index.
- Select Manage index > Delete.
- Type
DELETEto confirm and click Delete.
Delete indices with the API
Delete an index with either of the following:- Algolia CLI:
algolia indices delete(deletes one or more indices and, with--include-replicas, their replicas) - API clients:
deleteIndex
Delete multiple indices
To delete replica indices with an API client, first unlink them from their primary indices. To delete more than one index:- Select the indices to delete. To find available indices, use
listIndices. - Use
multipleBatchto delete the selected indices with a single request.
In a
multipleBatch request body, the requests property must contain a list of operations.
Don’t add an extra requests wrapper around this list.
An extra wrapper can cause an error such as “Requests attribute must be an array.”Delete indices with replicas
Deleting a primary index with an API client makes its replicas independent indices. To delete a replica index with an API client, first unlink it from its primary index. In the Algolia dashboard, you can delete replicas without manually unlinking them. The Algolia CLIalgolia indices delete command automatically unlinks replica indices before deleting them.
Unlink a replica from its primary
Thereplicas setting contains the list of replicas for a primary index.
To unlink a replica, remove its entry from this list with the setSettings method.
Keep the entries for all other replicas.
Setting replicas to an empty list ([]) unlinks all replicas.
waitForTask.
Then delete the unlinked index in the Algolia dashboard or with the API.
Clear indices
Clearing an index deletes only its records and keeps its settings, synonyms, and rules. The index doesn’t return any results until you add records again. Clearing a primary index also clears the records from its replicas.Clear indices in the Algolia dashboard
- Go to the Algolia dashboard and select your Algolia application.
- On the left sidebar, select Search.
- Select your Algolia index.
- Select Manage index > Clear.
- Type
CLEARto confirm and click Clear.
Clear indices with the API
To replace records without interrupting search, usereplaceAllObjects instead of clearing the index first.
To clear an index and delete all records,
use either of the following:
- API clients:
clearObjects - Algolia CLI:
algolia indices clear