The elips::Config struct specifies all indexing algorithms, distance metrics, HNSW graph connectivity, durability policies, and segment sizes.
Overview
Configuration objects are passed when opening an Database or initializing individual Collection instances.
Config Struct
cpp
struct Config {
std::uint16_t dimension{128};
Metric metric{Metric::cosine};
IndexType index_type{IndexType::hnsw};
HnswParams hnsw_params{};
Durability durability{Durability::sync_on_commit};
AccessMode access_mode{AccessMode::read_write};
std::size_t segment_size_bytes{64 * 1024 * 1024}; // 64MB default
};HnswParams Struct
cpp
struct HnswParams {
std::size_t m{16}; // Max bi-directional links per node
std::size_t ef_construction{200}; // Search queue capacity during construction
std::size_t ef_search{50}; // Search queue capacity during query time
float compaction_ratio{0.2f}; // Tombstone threshold to trigger auto-vacuum
};Metrics & Policies Enums
cpp
enum class Metric {
cosine,
euclidean,
dot_product
};
enum class IndexType {
hnsw,
flat,
ivf_flat,
ivf_pq
};
enum class Durability {
sync_on_commit, // fsync WAL on every commit
wal_only, // write WAL without forcing fsync immediately
in_memory // skip disk writing completely
};
enum class AccessMode {
read_write,
read_only
};IndexType maps onto the FAISS-style index classes: hnsw builds an IndexHNSW, flat an exact IndexFlat, ivf_flat an IndexIVFFlat, and ivf_pq an IndexIVFPQ. Use index_factory() to build one directly from a spec string.
Tuning Recipes
1. High Recall / Accuracy Setup
cpp
elips::Config config;
config.dimension = 1536;
config.metric = elips::Metric::cosine;
config.index_type = elips::IndexType::hnsw;
config.hnsw_params.m = 32;
config.hnsw_params.ef_construction = 400;
config.hnsw_params.ef_search = 128;2. Ultra Low Latency Setup
cpp
elips::Config config;
config.dimension = 384;
config.metric = elips::Metric::dot_product;
config.index_type = elips::IndexType::hnsw;
config.hnsw_params.m = 12;
config.hnsw_params.ef_construction = 100;
config.hnsw_params.ef_search = 24;