dynavec / Docs / Upsert

Upsert

Write documents to both stores in one call.

Each document carries an id, either text (which gets embedded) or a vector, and optional metadata. dynavec splits metadata: a small filterable subset goes to S3 Vectors, the full copy plus text goes to DynamoDB.

from dynavec import Document

db.upsert([
    Document(id="1", text="apple pie recipe", metadata={"cat": "food", "rating": 5}),
    Document(id="2", text="rocket launch schedule", metadata={"cat": "space"}),
], namespace="kb", auto_metadata=True)

The metadata switch

Re-upserting the same id overwrites it. Writes to the two stores run in parallel; see Concurrency. To change part of a document, use update.