Skip to main content
To create an encrypted index, you need to specify an index name (must be unique) and an index key:
from cyborgdb import Client

# Create a client
client = Client(
    base_url='http://localhost:8000', 
    api_key='your-api-key'
)

# Generate an encryption key for the index
index_key = client.generate_key(save=False)

# Create an encrypted index
index = client.create_index(
    index_name="my_index", 
    index_key=index_key
)
This creates a new encrypted DiskIVF index — the single index type in v0.17. For details on configuration knobs (dimension, metric, storage_precision, embedding_model), see Configure an Encrypted Index.
v0.17 removed the polymorphic index_config argument and the IndexIVFFlat / IndexIVFPQ / IndexIVFSQ constructors from previous versions. Optional parameters — metric ("euclidean", "squared_euclidean", "cosine"), dimension, embedding_model, storage_precision, and kms_name — are now flat keyword arguments on create_index. See the API Reference for details.
The example above creates a random 32 byte (256-bit) index key. This is fine for evaluation purposes, but for production use, we recommend that you use an HSM or KMS solution. For more details, see Managing Encryption Keys.

Index Caching

The service-based SDKs handle caching automatically on the server side. Unlike the embedded SDKs, you don’t need to specify cache sizes when creating indexes. The CyborgDB service optimizes query performance through:
  • Automatic index caching based on usage patterns
  • Server-side query optimization
  • Efficient index loading and memory management

Automatic Embedding Generation

To use automatic embedding generation, use the Docker Service or install with pip install cyborgdb-service[embeddings]
All Client SDKs support automatic embedding generation. You can specify an embedding model when creating the index:
from cyborgdb import Client

# Create a client
client = Client(
    base_url='http://localhost:8000', 
    api_key='your-api-key'
)

# Generate an encryption key for the index.
# `save=True` is available for local evaluation (caches the key under ~/.cyborgdb/);
# leave it as `save=False` (default) and persist the key in your own secret store.
index_key = client.generate_key(save=False)

# Set embedding model (from HuggingFace)
embedding_model = "all-MiniLM-L6-v2"

# Create an encrypted index with managed embedding generation
index = client.create_index(
    index_name="my_index", 
    index_key=index_key, 
    embedding_model=embedding_model
)

API Reference

For more information on creating encrypted indexes, refer to the API reference:

REST API Reference

REST API reference for /v1/indexes/create

Python SDK Reference

API reference for create_index() in Python

JS/TS SDK Reference

API reference for createIndex() in JavaScript/TypeScript

Go SDK Reference

API reference for CreateIndex() in Go