Deleting an index doesn’t delete the index’s analytics.
The analytics data remains available under the deleted index’s name.
For more information, see Indices and analytics.
Before you begin
Deleting an index removes that index and its records, rules, settings, and synonyms. Before you delete or clear an index, export its records and configuration to 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
deleteIndex. - If you list indices, also include
listIndexes. - If you unlink replicas, also include
editSettings.
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. Add--include-replicasto delete their replicas too. - API clients:
deleteIndex
Delete several 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,
set the requests property to an array of operations.
Don’t nest another requests property inside it.
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 replica indices
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