algolia / algolia/algoliasearch-client-javascript

Unable to delete virtual replica

Open
#1,377 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.4k
Forks
226
PR merge metrics
No merged PRs in 30d

Description

How does one go about deleting a virtual replica index?

Looking at the published documentation at
- https://www.algolia.com/doc/api-client/methods/indexing/#creating-indices
- https://www.algolia.com/doc/api-reference/api-methods/delete-index/
- https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/deleting-replicas/#using-the-api

It seems as though this should work, assuming a "main" index named "main" and a virtual replica named "virtual":
```
const client = algoliaSearch(ID, KEY);
const main = client.initIndex('main');
await main.setSettings({
replicas: []
});
const virtualIndex = client.initIndex('virtual');
await virtualIndex.delete();
```

However, the call to `initIndex` for `'virtual'` yields this error response:
```
{
name: 'ApiError',
message: 'cannot apply a add object request on a replica index',
status: 403,
}
```

Is there some way other than `initIndex` that I'm supposed to be getting a reference to a virtual replica index?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.