API Reference / API Methods / Manage indices / Delete index
Required API Key: any key with the deleteIndex ACL
Method signature
index.delete()

About this method # A

Delete an index and all its settings, including links to its replicas.

This method permanently removes an index from your application, and removes its metadata and configured settings (like searchable attributes and custom ranking).

Rather than use the API, you can delete indices using the dashboard.

If the index has replicas, they will be preserved but will no longer be linked to their primary index. Instead, they’ll become independent indices. If the index is a replica, you must first unlink it before you can delete it.

If you want to only remove records from the index, use the clear method. To delete more than one index, refer to the delete multiple indices guide.

Deleting an index won’t affect analytics data because you can’t delete an index’s analytics data.

If you select and attempt to delete a nonexistent index, the engine ignores the operation but doesn’t send back an error.

Examples # A

Delete an index by name#

1
2
3
4
5
//Sync version
index.delete();

//Async version
index.deleteAsync();

Parameters # A

indexName #
type: string
Required

Name of the index to be deleted.

Response # A

This section shows the JSON response returned by the API. Since each language encapsulates this response inside objects specific to that language and/or implementation, the actual type in your language might differ from what’s written here. You can view the response in the logs (using the getLogs method).

JSON format#

1
2
3
4
{
  "deletedAt": "2017-12-18T21:22:40.761Z",
  "taskID": 19541511530
}
deletedAt #
string

Date at which the job to delete the index has been created.

taskID #
integer

This is the taskID which is used with the waitTask method.

Did you find this page helpful?
Java v3