Once you have created or loaded an encrypted index, you can add items to it. To do this, you can use the upsert() function:

# Items to add to the encrypted index
items = [
    {"id": 1, "vector": [0.1, 0.2, 0.3, 0.4]},
    {"id": 2, "vector": [0.5, 0.6, 0.7, 0.8]},
    {"id": 3, "vector": [0.9, 0.10, 0.11, 0.12]}
]

# Add items to the encrypted index
index.upsert(items)

For more info on Array2D in C++, see the API Reference.

Adding Items with Contents

It’s also possible to store item contents alongside vectors. To do this, simply add item (which must be bytes) to the upsert() call:

# Items to add to the encrypted index
items = [
    {"id": 1, "vector": [0.1, 0.2, 0.3, 0.4], "item": "Hello!"},
    {"id": 2, "vector": [0.5, 0.6, 0.7, 0.8], "item": "World!"},
    {"id": 3, "vector": [0.9, 0.10, 0.11, 0.12], "item": "Cyborg!"}
]

# Add items to the encrypted index
index.upsert(items)

Understanding Conflicts & Updates

Since Cyborg Vector Search is end-to-end encrypted, it cannot manage conflicts and updates in the way that “traditional” Vector DBs do. Since index contents can’t be viewed server-side, conflicts are handled client-side. The way this works is simple: upsert calls on the same ID will logically “overwrite” the ID, but not via a deletion. Rather, the original entry is kept but ignored in favor of the second one during query operations.

API Reference

For more information on adding items to an encrypted index, refer to the API reference: