VECSET
Store a vector in the index. SyntaxThe key to store the vector under
The dimensionality of the vector
The vector components (must match dim count)
OK if the vector was stored successfully
- Vectors are automatically normalized for cosine similarity
- All vectors in an index must have the same dimensionality
- The first VECSET determines the dimension for subsequent inserts
VECQUERY
Find the K nearest neighbors to a query vector. SyntaxThe index key pattern or base key
Number of nearest neighbors to return
The query vector components
Array of (key, distance) pairs, sorted by distance
- Returns up to k results (may be fewer if index has fewer vectors)
- Distances are cosine distances (lower is more similar)
- Query vector is automatically normalized
VECDEL
Delete a vector from the index. SyntaxThe key of the vector to delete
1 if the vector was deleted, 0 if it did not exist
Configuration
HNSW Parameters
The HNSW index is configured with the following default parameters:- M (connectivity): 16 - Number of bi-directional links per node
- ef_construction: 200 - Search width during index construction
- ef_search: 100 - Search width during query (configurable per query)
Distance Metrics
Kora supports three distance metrics:-
Cosine Similarity (default)
- Measures angular similarity between vectors
- Range: [0, 2] where 0 is identical
- Automatically normalizes vectors
-
L2 Distance (Euclidean)
- Measures straight-line distance
- Range: [0, ∞)
- No normalization applied
-
Inner Product
- Dot product similarity
- Range: (-∞, ∞)
- Higher values indicate greater similarity
Performance Characteristics
Index Build
- Memory usage: ~(4 * dim + 8 * M) bytes per vector
- Build time: O(N * M * log N) for N vectors
- Suitable for millions of vectors with hundreds of dimensions
Query Performance
- Typical recall@10: Greater than 95% with default parameters
- Query latency: Less than 1ms for 100K vectors, less than 10ms for 1M vectors
- Scalable to 10M+ vectors per shard
Tuning Guidelines
For higher recall:- Increase M (e.g., 32 or 64)
- Increase ef_construction (e.g., 400)
- Trade-off: larger memory footprint, slower indexing
- Decrease ef_search
- Trade-off: lower recall
- Decrease M and ef_construction
- Trade-off: lower recall
Use Cases
Semantic Search
Image Similarity
Recommendation Systems
Implementation Notes
- HNSW index is implemented per-shard with no cross-shard coordination
- Vectors are stored in-memory for fast access
- Index structure is optimized for read-heavy workloads
- Supports concurrent queries without locks
- Index is not persisted by default (rebuild on restart)
Comparison with Redis
Kora’s vector search is similar to RediSearch’s vector capabilities but with key differences:- Kora uses pure HNSW (no flat index fallback)
- Lower memory overhead per vector
- Better multi-threaded query performance due to shard-affinity
- Simpler command interface (no FT. prefix)
- No persistence of vector index (in-memory only)