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 types and the indexConfig argument no longer exist.

Parameters

Key management

Pass exactly one of indexKey or kmsName. The service rejects both together with CyborgDBValidationError (HTTP 400), whatever the KMS provider.
  • SDK-supplied KEK: pass indexKey. Supply the same key again on every loadIndex().
  • KMS-backed: pass kmsName. The service generates the key, wraps it with the named provider, and stores the wrapped key. Later calls omit indexKey.

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'.
Each field takes three settings (the MetadataFieldPolicy type):

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 above:
The stored policy is returned by the metadataSchema() getter.

Returns

Promise<EncryptedIndex> bound to the new index. For KMS-backed indexes it holds no plaintext key.

Exceptions

  • Neither indexKey nor kmsName is passed, or indexKey is not 32 bytes. Thrown before any request is sent.
  • The service rejects the request (HTTP 400/422): the index name already exists, both indexKey and kmsName were passed, 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 for the full hierarchy.

Example Usage

SDK-supplied key

Store indexKey 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