vector
batch_upsert
Upsert multiple vectors in one itemwise batch.
db.vectors.upsert_many(collection: 'str', entries: 'Any') -> 'BatchResult'wire vector_batch_upsert
Writes multiple vector entries and returns positional mutation results. Valid items share commit facts where the engine applies them together.
Itemwise batches return one positional item result per input item. The outer batch status summarizes whether all, some, or none of the items succeeded.
To see the complete help for this command, run:
help(db.vectors.upsert_many)
Example
Upsert many vectors in one commit.
_ = db.vectors.create_collection("docs", 3, metric="cosine")_ = db.vectors.upsert_many("docs", [{"key": "a", "vector": [1.0, 0.0, 0.0]}, {"key": "b", "vector": [0.0, 1.0, 0.0]}])db.vectors.count("docs")
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| collection | string | yes | Collection name. |
| entries | array | yes | Entries to write. |
| branch | string or null | no | Target branch. Defaults to the executor handle branch. |
| space | string or null | no | Target product space. Defaults to `"default"`. |
Returns
BatchResult<VectorMutationItem>
- dataBatchResult7
- typestring
Errors
Recover by code. Retry policy and commit outcome come from the shipped error registry.
| Code | Retry | Commit outcome |
|---|---|---|
| failed_precondition.engine.runtime_closed | never | not_started |
| not_found.engine.branch | never | not_applicable |
| invalid_argument.engine.product_space | never | not_started |
| invalid_argument.engine.vector_collection | never | not_started |
| invalid_argument.engine.vector_key | never | not_started |
| not_found.engine.vector_collection | never | not_applicable |
| invalid_argument.engine.vector_batch | never | not_started |
| invalid_argument.engine.vector_dimension | never | not_started |
| invalid_argument.engine.vector_embedding | never | not_started |
| invalid_argument.executor.vector_dimension | never | not_started |
| invalid_argument.executor.vector_batch_duplicate_key | never | not_started |