v0.17 introduces a single DiskIVF index type. The polymorphic
IndexIVFFlat / IndexIVFPQ / IndexIVFSQ helpers and the IndexConfig field have been removed — configuration is now expressed as flat fields on CreateIndexParams (Dimension, Metric, StoragePrecision).Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | context.Context | Context for cancellation/timeouts |
params | *CreateIndexParams | Configuration for the new index |
CreateIndexParams
| Field | Type | Required | Description |
|---|---|---|---|
IndexName | string | Yes | Unique identifier for the index |
IndexKey | []byte | Conditional | 32-byte encryption key. Required when KmsName is nil; mutually exclusive with KmsName against a real-KMS slot. |
KmsName | *string | Conditional | Name of a kms.registry entry in the service YAML. Required when IndexKey is nil. |
Dimension | *int32 | No | Vector dimensionality. Auto-detected from the first upsert if nil. |
Metric | *string | No | Distance metric ("euclidean", "squared_euclidean", "cosine"). Defaults to the server’s default ("euclidean"). |
EmbeddingModel | *string | No | Optional sentence-transformers model name for automatic embedding generation. |
StoragePrecision | *string | No | On-disk rerank-vector dtype: "float32" (default) or "float16". |
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 — set
IndexKey, leaveKmsNamenil. The server records the index withprovider: none; you must re-supply the same key on every subsequent call. - KMS-backed — set
KmsName, leaveIndexKeynil. The server generates the DEK, wraps it under the named registry slot, and persists the envelope. Subsequent calls omitIndexKeyentirely.
Returns
| Type | Description |
|---|---|
*EncryptedIndex | Handle for performing vector operations on the new index |
error | Any error encountered during index creation |
Errors
Common errors
Common errors
ErrMissingKeyOrKMS— Returned when neitherIndexKeynorKmsNameis provided.- Returns error if
IndexKeyis provided but is not exactly 32 bytes. - Returns error if the index name already exists on the server.
- Returns error if both
IndexKeyandKmsNameare provided against a real-KMS slot (server-side 400). - Returns error if the embedding model is unsupported.
Service Errors
Service Errors
- Returns error if the CyborgDB service is unavailable or unreachable.
- Returns error 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
Auto-embedding with cosine metric
Float16 storage for reduced footprint
For more info on auto-generating embeddings, refer to Auto-Generate Embeddings.