> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cyborg.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Load Index

Loads an existing encrypted index and returns an instance of `EncryptedIndex`.

```python theme={null}
def load_index(self, index_name: str, index_key: bytes, max_cache_size: int = 0)
```

### Parameters

| Parameter        | Type    | Description                                                                                |
| ---------------- | ------- | ------------------------------------------------------------------------------------------ |
| `index_name`     | `str`   | Name of the index to load.                                                                 |
| `index_key`      | `bytes` | 32-byte encryption key; must match the key used during [`create_index()`](./create-index). |
| `max_cache_size` | `int`   | *(Optional)* Maximum size of local cache to keep for encrypted index. Defaults to `0`.     |

### Returns

`EncryptedIndex`: An instance of the loaded encrypted index.

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    * Throws if the index name does not exist.
  </Accordion>

  <Accordion title="RuntimeError">
    * Throws if the index could not be loaded or decrypted.
  </Accordion>
</AccordionGroup>

### Example Usage

```python theme={null}
import cyborg_vector_search_py as cvs

index_location = cvs.DBConfig(location='redis', connection_string="redis://localhost")
config_location = cvs.DBConfig(location='redis', connection_string="redis://localhost")

client = cvs.Client(index_location=index_location, config_location=config_location)

index_name = "my_index"
index_key = my_index_key  # Use the same 32-byte encryption key used during index creation

# Load the existing index
index = client.load_index(index_name=index_name, index_key=index_key)
```
