Skip to main content
Loads and returns an existing EncryptedIndex instance.
client.load_index(
    index_name,
    index_key = None,
)

Parameters

ParameterTypeDescription
index_namestrName of an existing index
index_keybytes(Optional) 32-byte encryption key. Required for indexes created with the SDK-supplied KEK path (provider: none); omit for KMS-backed indexes.
In v0.17 index_key is optional. KMS-backed indexes (created with kms_name) omit it — the server resolves the DEK via the persisted KMSBlob. SDK-supplied indexes (created with only index_key) must re-supply the same 32-byte key here.
For SDK-supplied indexes, the encryption key must exactly match the key used during index creation. KMS-backed indexes are tied to their kms_name slot in the service YAML — load fails if that slot is missing or unreachable.

Returns

An instance of EncryptedIndex bound to the loaded index. The SDK probes the describe endpoint during load, so a missing or inaccessible index raises here rather than silently returning a phantom handle.

Exceptions

  • Raised if index_key is provided but is not exactly 32 bytes.
  • Raised if the index does not exist on the server (the describe probe fails).
  • Raised if the supplied key does not match the cached envelope hash (SDK-supplied path).
  • Raised by the server if a KMS-backed index’s slot is unavailable.
  • Raised if the API request fails due to network issues.
  • Raised if the server returns an HTTP error status.
  • Raised if the server is unreachable or times out.

Example Usage

SDK-supplied index

from cyborgdb import Client

client = Client(base_url='http://localhost:8000', api_key='your-api-key')

# Same 32-byte key used during create_index()
index_key = your_existing_32_byte_key

index = client.load_index("my_index", index_key)

KMS-backed index

# No key required — the server resolves the DEK via the index's KMSBlob.
index = client.load_index("kms_index")