If you’ve previously created an encrypted index, you can connect to it to add, query or delete data from it. You will need to know the index’s name as well as its key to do so:
This is only applicable to the CyborgDB SDKs. The REST API is stateless, so you don’t need to load indexes explicitly.
from cyborgdb import Client, IndexIVF

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

# Provide the same index key and config used when creating the index
index_key = your_existing_32_byte_key  # Must be the same key used originally
index_config = IndexIVF(
    type='ivf',
    dimension=768,
    n_lists=1024,
    metric='cosine'
)

# Connect to existing index (or create if it doesn't exist)
index = client.create_index("my_index", index_key, index_config)
This connects to an existing encrypted index on the service. For more details on index types and configurations, see Configure an Encrypted Index.
You must provide the exact same index key and configuration that was used when the index was originally created. For production use, we recommend that you use an HSM or KMS solution for key management. For more details, see Managing Encryption Keys.

Key Points

  • Same Method: Service SDKs use createIndex() for both creating new indexes and connecting to existing ones
  • Exact Match Required: The index key and configuration must exactly match the original
  • Automatic Detection: The service automatically determines whether to create or connect based on the index name
  • No Separate Load Method: Unlike embedded SDKs, service SDKs don’t have a separate loadIndex() method

Index Caching

Index caching is handled automatically by the CyborgDB service. The service optimizes performance through:
  • Automatic Caching: Frequently accessed indexes are cached automatically
  • Smart Eviction: Least recently used indexes are evicted when memory is needed
  • Server-Side Optimization: No client-side cache configuration required

API Reference

For more information on loading an encrypted index, refer to the API reference: