How to replace or delete records using API?

I’m using Angular 8/Algolia 3.35.1.

I can use index.addObjects fine, but this keeps adding more records to my index. In the v4 API, I found index.replaceAllObjects, but using it produces error index.replaceAllObjects is not a function.

How can I replace all records in an index when using Algolia v3?

component.ts producing error

  index
    .replaceAllObjects(JSON.parse(this.searchData.records))
    .then((content: any) => console.log(content))
    .catch((err: any) => console.error(err));

Hello @engineering,

Happy to provide our v3 guide. As you noted it is deprecated but still available for review:

Thanks Ajay, that got it working.

1 Like