You can delete a standard or virtual replica through the API or your Algolia dashboard.
Using the API
To delete a standard or virtual replica index through the API, you need to use the setSettings method on the original index to unlink the replica, then use the deleteIndex method on the replica index to delete it.
In the below example, we want to delete the products_price_asc replica.
If the primary index has other replica indices which you don’t want to unlink, they should remain in the replicas parameter.
primary_index.setSettings(["replicas":[]])client.deleteIndex(withName:"products_price_asc",completionHandler:{(content,error)->Voidiniferror!=nil{print("Could not delete: \(error!)")}})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
IndexSettingssettings=newIndexSettings{Replicas=newList<string>{}};// Set Settings--Synchronousprimary_index.SetSettings(settings);// Set Settings--Asynchronousawaitprimary_index.SetSettingsAsync(settings);// Deletion--Synchronousproducts_price_asc.Delete();// Deletion--Asynchronousawaitproducts_price_asc.DeleteAsync();