4. IndexConfig() Reference 🧩

IndexConfig is the SDK object that holds all index-related settings in one place: identity (name, dimension), key management, and crypto/search presets. You can build it directly, or let the helpers (ev.init_index_config(...) + ev.create_index(...)) construct and use it for you.

When to use

  • You want a single, explicit object to pass around across functions or tests.

  • You need to clone/adjust configuration safely (e.g., same key_path, different index_name or dim).

Constructor (most-used fields)

  • Identity

    • index_name (str): Unique name of the index

    • dim (int): Vector dimension (max 4096)

  • Key management

    • key_path (str): Base directory for key sets

    • key_id (str): ID for a key set under key_path

    • metadata_encryption (bool): Encrypt metadata at rest/in transit

    • seal_mode ("none" | "aes"): Seal secret/materialized keys at rest

    • seal_kek_path (str): File path to KEK when seal_mode='aes'

  • Presets and modes

    • preset ("ip"): Crypto preset (inner-product optimized)

    • eval_mode ("rmp" | "mm"): Evaluation mode on server. Use rmp for both plaintext and encrypted queries. mm is advanced and currently does not support encrypted queries (query_encryption="cipher").

    • index_type ("flat"): Index structure

    • query_encryption ("plain" | "cipher"): Encrypt queries

    • index_encryption ("cipher"): Always encrypted storage

See details in:

    1. Index Name and Dimension: index_name, dim

    1. 🔑 Key Management: key_path, key_id, metadata_encryption, seal_mode, seal_kek_path

    1. 🚀 Presets: preset, eval_mode, index_type, query_encryption, index_encryption

Example: Build and create via class

from pyenvector.index import IndexConfig, Index
from pyenvector.api import Indexer

# Prepare config explicitly
cfg = IndexConfig(
    index_name="products",
    dim=768,
    key_path="./keys",
    key_id="my-key",
    metadata_encryption=True,
    seal_mode="none",
    preset="ip",
    eval_mode="rmp",
    index_type="flat",
    query_encryption="cipher",
    index_encryption="cipher",
)

# Connect and create
indexer = Indexer.connect(address="localhost:50050")
index = Index.create_index(indexer=indexer, index_config=cfg)

Example: Helpers that use IndexConfig under the hood

import pyenvector as ev

ev.init_connect(address="localhost:50050")
ev.init_index_config(
    key_path="./keys",
    key_id="my-key",
    metadata_encryption=True,
    preset="ip",
    index_type="flat",
    query_encryption="cipher",
)
# Pass identity explicitly when creating
index = ev.create_index(index_name="products", dim=768)

Clone/adjust safely

from pyenvector.index import IndexConfig

base = IndexConfig(index_name="base", dim=512, key_path="./keys", key_id="main")
# Create a variant with another name / dimension
variant = base.deepcopy(index_name="products", dim=768)

Notes

  • All vectors inserted into an index must match the configured dim.

  • index_encryption is always "cipher" in enVector.

  • Max supported dimension is 4096.

Last updated