typesense / typesense

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Home Page:https://typesense.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deleting all documents in collection

ybirader opened this issue · comments

Description

I understand that Typesense does not currently support truncating a collection.

Would the following delete all documents in a collection?

client.collections('test').documents().delete({ filter_by: 'id>=0' })

An alternative could be to simply delete the collection and recreate it:

 const schema = await client.collections(indexName).retrieve();
 await client.collections(indexName).delete();
 return client.collections().create(schema);

If there is an alternative way to accomplish this, please let me know.

Would the following delete all documents in a collection?

client.collections('test').documents().delete({ filter_by: 'id>=0' })

No, since id is a string field.

An alternative could be to simply delete the collection and recreate it

This is indeed the workaround for now.

We're tracking the truncation feature request here - Duplicate of #1016

Could you thumbs up it?