Skip to main content
This action is irreversible. Proceed with caution.
Deletes the specified encrypted items stored in the index, including all its associated fields (vector, contents, metadata).
def delete(self,
           ids: List[str],
           *,
           index_key: bytes = None,
           user_id: bytes = None)

Parameters

ParameterTypeDescription
idsList[str]IDs to delete.
index_keybytes(Optional, keyword-only) Override the per-operation index key. See Per-operation key override.
user_idbytes(Optional, keyword-only) 16-byte RBAC user identifier. See Per-operation key override.

Exceptions

  • Throws if the items could not be deleted.

Example Usage

# Load index
index = client.load_index(
    index_name=index_name, 
    index_key=index_key
)

# Delete "item_1" and "item_2"
index.delete(["item_1", "item_2"])

Per-operation key override

The call above reuses the key supplied at create_index() / load_index(). You may instead pass index_key= (and user_id= for an RBAC user) to override the per-operation key. This is required in stateless/service deployments that reload the index per request:
index.delete(["item_1", "item_2"], index_key=index_key)
Deleting items requires write permission. An RBAC user without a write wrap cannot delete items.