> For the complete documentation index, see [llms.txt](https://docs.envector.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.envector.io/1.4.x/sdk-user-guide/initialize/index-configuration/3.-indexconfig.md).

# 3. 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'`
  * `key_store` ("local" | "aws"): Store keys on the filesystem or upload/load them via AWS (requires `region_name`, `bucket_name`, `secret_prefix`)
* Presets and modes
  * `preset` ("ip1" | "ip2", default `"ip2"`): Crypto preset (inner-product optimized). Strictly coupled with `eval_mode` for MM-family modes — see [Presets](/1.4.x/sdk-user-guide/initialize/index-configuration/2.-presets.md).
  * `eval_mode` ("mm" | "mms" | "mm32" | "mms32", default `"mm32"`): Evaluation mode on server. Setting an MM-family mode automatically pins `preset` (`mm`/`mms` → `ip1`, `mm32`/`mms32` → `ip2`). See [Presets](/1.4.x/sdk-user-guide/initialize/index-configuration/2.-presets.md) for the full table and trade-offs.
  * `index_type` ("flat"): Index structure
  * `query_encryption` ("plain"): Encrypt queries
  * `index_encryption` ("cipher"): Always encrypted storage

See details in:

1. [Index Name and Dimension 📇](/1.4.x/sdk-user-guide/initialize/index-configuration/1.-basic-index-identification.md): `index_name`, `dim`
2. [🚀 Presets](/1.4.x/sdk-user-guide/initialize/index-configuration/2.-presets.md): `preset`, `eval_mode`, `index_type`, `query_encryption`, `index_encryption`
3. [🔑 Key Management](/1.4.x/sdk-user-guide/initialize/key-config.md): `key_path`, `key_id`, `metadata_encryption`, `seal_mode`, `seal_kek_path`, `key_store`, `region_name`, `bucket_name`, `secret_prefix`

## Example: Build and create via class

```python
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="ip2",
    eval_mode="mm32",
    index_type="flat",
    query_encryption="plain",
    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

```python
import pyenvector as ev

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

## Clone/adjust safely

```python
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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.envector.io/1.4.x/sdk-user-guide/initialize/index-configuration/3.-indexconfig.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
