Parameters
Parameter | Type | Description |
---|---|---|
ctx | context.Context | Context for cancellation/timeouts |
params | *CreateIndexParams | Complete configuration for the new index |
CreateIndexParams
Field | Type | Required | Description |
---|---|---|---|
IndexName | string | Yes | Unique identifier for the index |
IndexKey | []byte | Yes | 32-byte encryption key |
IndexConfig | IndexModel | No | Index configuration (IVF, IVFFlat, or IVFPQ) |
Metric | *string | No | Distance metric (e.g., “euclidean”, “cosine”) |
EmbeddingModel | *string | No | Associated embedding model name |
Returns
Type | Description |
---|---|
*EncryptedIndex | Handle for performing vector operations on the new index |
error | Any error encountered during index creation |
Exceptions
Error
Error
- Throws if the index name already exists on the server.
- Throws if the index configuration is invalid or missing required parameters.
- Throws if the encryption key is not exactly 32 bytes.
- Throws if the embedding model is not supported by the server.
Service Errors
Service Errors
- Throws if the CyborgDB service is unavailable or unreachable.
- Throws if there are internal server errors on the CyborgDB service.
Example Usage
Automatic Index Config
For more info on
generateKey
, refer to Generate Key.IVFFlat Index with Embedding Model
For more info on auto-generating embeddings, refer to Auto-Generate Embeddings.