Skip to main content
Loads an existing encrypted index and returns an EncryptedIndex bound to it.

Parameters

For SDK-supplied-key indexes, indexKey must be the exact key passed to createIndex(). A KMS-backed index fails to load if its kmsName slot is missing from the service YAML or its provider is unreachable, with CyborgDBAuthenticationError (HTTP 401).

Returns

Promise<EncryptedIndex> bound to the loaded index.

Exceptions

indexKey is passed but is not 32 bytes. Thrown before any request is sent.
No index named indexName exists, or indexKey doesn’t match (HTTP 404, in most cases).
indexKey doesn’t match an index that has vectors and is already in the service’s cache, or the client’s apiKey is missing or invalid; or, for a KMS-backed index, its KMS slot is missing or the provider call fails (HTTP 401).
The service returns 5xx.
The service can’t be reached.
See Errors for the full hierarchy.
A wrong key returns CyborgDBAuthenticationError (HTTP 401) when the index has vectors and the service already has it cached, and CyborgDBNotFoundError (HTTP 404) otherwise, for example on an empty index or right after the service restarts. Catch both when checking for a bad key.

Example Usage

SDK-supplied-key index

Buffer is Node-only; in a browser or Edge runtime, decode the hex string with your own helper.

KMS-backed index