Skip to main content
Creates a new encrypted index on the service and returns an *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 them nil 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 of IndexKey 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 every LoadIndex.
  • KMS-backed: set KmsName. The service generates the key, wraps it with the named provider, and stores the wrapped key. Later calls pass a nil key.

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:
The stored policy is returned by the MetadataSchema getter.

Returns

The *EncryptedIndex bound to the new index. For KMS-backed indexes it holds no plaintext key.

Errors

  • Wraps ErrNilParams, ErrMissingKeyOrKMS, or ErrInvalidKeyLength. params is nil, neither IndexKey nor KmsName is set, or IndexKey isn’t 32 bytes. Returned before any request is sent.
  • The service rejects the request (HTTP 400/422): the index name already exists, both IndexKey and KmsName are set, the KmsName slot is unknown, StoragePrecision isn’t one of the six values, or MetadataSchema combines settings that aren’t allowed.
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).
The service returns 5xx, including KMS wrap failures (502).
The service can’t be reached.
See Errors.

Example Usage

SDK-supplied key

Store the key securely: it is needed to load the index again. See Generate Key.

Explicit dimension and metric

KMS-backed index

Automatic embeddings

See Auto-Generate Embeddings.

Reduced storage with TurboQuant

Per-field metadata policy

Full-text search fields