*EncryptedIndex bound to it.
There is one index type, configured with flat fields. The earlier
IndexIVFFlat, IndexIVFPQ, and IndexIVFSQ helpers and the IndexConfig field no longer exist.Parameters
CreateIndexParams
Optional scalar fields are pointers: leave themnil to use the service default, or set them with the cyborgdb.Int32, cyborgdb.String, cyborgdb.Float64, and cyborgdb.Bool helpers.
Key management
Set exactly one ofIndexKey or KmsName. The service rejects both together with a *ValidationError (HTTP 400), whatever the KMS provider.
- SDK-supplied KEK: set
IndexKey. Pass the same key again on everyLoadIndex. - KMS-backed: set
KmsName. The service generates the key, wraps it with the named provider, and stores the wrapped key. Later calls pass anilkey.
Storage precision
StoragePrecision sets the format used to store the index’s vector embeddings. Every value works with every metric.
The
tq* values are TurboQuant tiers; lower tiers use less storage in exchange for a small recall and latency cost.
Metadata schema
MetadataSchema sets how each metadata field is indexed. Metadata itself stays schemaless: this controls indexing, not what may be stored. Fields left out get the default policy (indexed and filterable). Nested fields use dot-paths such as "loc.city".
MetadataFieldPolicy has three *bool fields; nil means the default:
Filters the index cannot answer
The index can answer a filter when the field is filterable and, for$regex or $contains, the field also has pattern set. Any other filter is handled differently depending on the call:
With the schema from the per-field example below:
MetadataSchema getter.
Returns
The*EncryptedIndex bound to the new index. For KMS-backed indexes it holds no plaintext key.
Errors
*ValidationError
*ValidationError
- Wraps
ErrNilParams,ErrMissingKeyOrKMS, orErrInvalidKeyLength.paramsisnil, neitherIndexKeynorKmsNameis set, orIndexKeyisn’t 32 bytes. Returned before any request is sent. - The service rejects the request (HTTP
400/422): the index name already exists, bothIndexKeyandKmsNameare set, theKmsNameslot is unknown,StoragePrecisionisn’t one of the six values, orMetadataSchemacombines settings that aren’t allowed.
*AuthenticationError
*AuthenticationError
The client’s
apiKey is missing or invalid (HTTP 401), or is a per-user key: creating an index requires the root key (HTTP 403).*ServiceError
*ServiceError
The service returns
5xx, including KMS wrap failures (502).*TransportError
*TransportError
The service can’t be reached.
Example Usage
SDK-supplied key
Store the key securely: it is needed to load the index again. See Generate Key.