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 keyword arguments. The earlier IndexIVFFlat, IndexIVFPQ, and IndexIVFSQ types and the index_config argument no longer exist.

Parameters

Key management

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

Storage precision

storage_precision 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

metadata_schema 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:

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 metadata_schema getter.

Returns

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

Exceptions

Before any request is sent: neither index_key nor kms_name is passed, index_key is not 32 bytes, or storage_precision is not one of the six values above. From the service: the index name already exists, both index_key and kms_name were passed, or the kms_name slot is unknown (HTTP 400); or metadata_schema combines settings that aren’t allowed (HTTP 422).
The client’s api_key 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 index_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