Docs
Skip to content

VectorsDB

Bulk operations_

Perform bulk operations on documents within your collections for efficient data handling in Appwrite VectorsDB.

3 min read

Raw

Appwrite VectorsDB supports bulk operations for documents, allowing you to create, update, or delete multiple documents in a single request. This can significantly improve performance for apps as it allows you to reduce the number of API calls needed while working with large data sets.

Bulk operations can only be performed via the server-side SDKs. The client-side SDKs do not support bulk operations by design to prevent abuse and protect against unexpected costs. This ensures that only trusted server environments can perform large-scale data operations.

For client applications that need bulk-like functionality, consider using Appwrite Functions with proper rate limiting and validation.

Each document's data follows the fixed schema provisioned by its collection: an embeddings vector whose length must equal the collection's dimension, and an optional free-form metadata object. The examples on this page use a collection with dimension: 4 to keep the arrays readable.

Atomic behavior

Bulk operations in Appwrite are atomic, meaning they follow an all-or-nothing approach. Either all documents in your bulk request succeed, or all documents fail.

This atomicity ensures:

  • Data consistency: Your database remains in a consistent state even if some operations would fail.
  • Race condition prevention: Multiple clients can safely perform bulk operations simultaneously.
  • Simplified error handling: You only need to handle complete success or complete failure scenarios.

For example, if you attempt to create 100 documents and one fails due to a validation error, none of the 100 documents will be created.

Plan limits

Bulk operations have different limits based on your Appwrite plan:

PlanDocuments per request
Free100
Pro1,000
Scale2,500

These limits apply to all bulk operations including create, update, upsert, and delete operations. If you need higher limits than what the Pro plan offers, you can inquire about a custom plan.

Create documents

You can create multiple documents in a single request using the createDocuments method.

Update documents

You can update multiple documents in a single request using the updateDocuments method. Pass the fields to change in data, and use queries to select which documents are affected.

Upsert documents

You can upsert multiple documents in a single request using the upsertDocuments method. Documents with a new $id are created, while documents with an existing $id are updated.

Delete documents

You can delete multiple documents in a single request using the deleteDocuments method.

Use transactions

updateDocuments, upsertDocuments, and deleteDocuments accept a transactionId. When provided, Appwrite stages the bulk request and applies it on commit. See Transactions.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.