EncryptedIndex instance backed by a new encrypted DiskIVF index on the server.
v0.17 introduces a single DiskIVF index type. The polymorphic
IndexIVFFlat / IndexIVFPQ / IndexIVFSQ types and the indexConfig argument have been removed — index configuration is now expressed as flat keyword arguments (dimension, metric, storagePrecision).Parameters
| Parameter | Type | Description |
|---|---|---|
indexName | string | Name of the index to create. Must be unique within the CyborgDB service. |
indexKey | Uint8Array | (Optional) 32-byte encryption key. Required when kmsName is omitted. Must be omitted when kmsName references a real KMS provider. |
kmsName | string | (Optional) Name of a kms.registry entry in the service YAML. When supplied, the server generates the KEK and wraps it via the named provider; the SDK never sees the plaintext key. |
dimension | number | (Optional) Vector dimensionality. If omitted, the server auto-detects from the first upsert. |
metric | 'euclidean' | 'squared_euclidean' | 'cosine' | (Optional) Distance metric. If omitted, the SDK does not set a value and the server applies its default. |
embeddingModel | string | (Optional) sentence-transformers model name for automatic embedding generation. |
storagePrecision | 'float32' | 'float16' | (Optional) On-disk rerank-vector dtype. Defaults to 'float32'. |
Key Management Modes
At least one ofindexKey / kmsName must be supplied; supplying both against a real-KMS slot is rejected by the server:
- SDK-supplied KEK — pass
indexKey, omitkmsName. The server records the index withprovider: none; you must re-supply the same key on every subsequent call. - KMS-backed — pass
kmsName, omitindexKey. The server generates the DEK, wraps it under the named registry slot, and persists the envelope. Subsequent calls omitindexKeyentirely.
Returns
Promise<EncryptedIndex>: A Promise that resolves to a handle bound to the newly created index.
Exceptions
Error
Error
- Throws if neither
indexKeynorkmsNameis provided. - Throws if
indexKeyis provided but is not exactly 32 bytes. - Throws if the index name already exists on the server.
- Throws if the embedding model is not supported by the server.
- Throws if both
indexKeyandkmsNameare provided against a real-KMS slot (rejected by the server with 400).
Service Errors
Service Errors
- Throws if the CyborgDB service is unavailable or unreachable.
- Throws on 5xx responses, including KMS-wrap failures (502).
Example Usage
SDK-supplied key
For more info on
generateKey, refer to Generate Key.KMS-backed index
With embedding model
Float16 storage for reduced footprint
For more info on auto-generating embeddings, refer to Auto-Generate Embeddings.