Insert and Upsert
After the initial build, you can add new vectors to an existing index using insert mode or update existing vectors using upsert mode. These operations allow you to keep your index up-to-date without rebuilding from scratch.Insert Mode
Useinsert mode to add new vectors to an existing index.
When to Use Insert
Use insert mode when you want to add entirely new vectors to an existing index. Common scenarios include:- Adding new documents or items as they become available
- Periodic batch updates from a data pipeline
- Incremental indexing of streaming data
Upsert Mode
Useupsert mode to replace existing records or insert new records.
"existing_id" already exists, Brinicle marks the old record as deleted and inserts the new version.
If "existing_id" does not exist, it is inserted as a new record.
When to Use Upsert
Use upsert mode when you want to update existing vectors or add new ones in a single operation. Common scenarios include:- Refreshing embeddings for existing items (e.g., after re-encoding with a new model)
- Syncing an index with a source of truth where items may be updated
- Correcting errors in previously ingested vectors
Performance Considerations
Both insert and upsert operations add vectors to the delta segment of the index. This means:- New vectors are immediately searchable after
finalize()— no need to rebuild the entire index - The delta segment grows with each insert/upsert cycle, which may gradually increase query latency
- Periodic rebuild using
rebuild_compact()can merge the delta segment back into the main segment for optimal performance
Delta Segment and Rebuilds
Thedelta_ratio parameter controls how large the delta segment can grow relative to the main segment. When the delta segment exceeds this ratio, search performance may degrade. You can check if a rebuild is needed and perform one: