Redis Vector Search
Redis vector search is vector similarity search implemented on Redis through the RediSearch module, letting Redis, originally a cache, also handle nearest neighbor recall. Its position is the ultra-low-latency online service layer: it does not pursue massive storage but millisecond-level results, and it often pairs with a primary database to form a two-tier retrieval architecture.
Core principles
At the core is the vector field type provided by RediSearch. When creating an index, a field is declared as a vector field with a specified dimension, distance metric (cosine, inner product, Euclidean) and index algorithm. Data is written as hashes or JSON, with vectors stored together with ordinary fields such as price, category and timestamp, so retrieval can pre-filter on these fields at the same time.
Index algorithms come in two kinds, FLAT and HNSW. FLAT is brute-force exact search, comparing one by one; results are accurate but complexity grows linearly with data volume, suiting small datasets or scenarios with extremely high precision requirements. HNSW is a graph index that brings lookups down to roughly logarithmic levels through hierarchical navigation, with the recall-latency balance tunable through parameters, and it is the choice for most online scenarios. Both index types reside in memory, which is the root cause of its low latency and also means capacity is limited by total memory.
Queries use RediSearch query syntax, writing the vector retrieval condition and field filter conditions in one statement and returning results sorted by distance. Because Redis processes commands in a single thread and its data structures are efficient, P99 latency on small datasets is very stable, making it suitable for the front of recommendation and search chains.
Key points
Low-latency memory: comparison happens in memory, saving disk IO, which is its core advantage over disk-based vector databases.
Coexistence with other structures: vector indexes can coexist with strings, sets, sorted sets and expiration times, so caching, rate limiting, sessions and vector recall share one instance.
Persistence and capacity: snapshots and append-only logs can be configured for persistence, but the overall positioning is still an in-memory store; massive vectors drive up memory cost, so usually only hot data is kept.
Comparison: architectures needing millisecond responses, data within millions of vectors and fewer systems are the best fit; for tens of millions of vectors or complex analytical queries, PGVector or a dedicated vector database is more suitable. Operationally it requires familiarity with Redis clusters and module deployment, taking more manpower than a pure managed service.
Common misconceptions
First, treating it as primary storage and ignoring memory cost and persistence risk, with an unclear recovery strategy after a restart. Second, blindly adopting HNSW even for small datasets, when FLAT is actually more accurate and simpler. Third, ignoring indexes on filter fields, since poorly built pre-filters degrade vector retrieval.
Application scenarios
Clusters and scaling: a Redis cluster shards by slot, and vector indexes are built on the shards; retrieval must send requests to the relevant shards separately and then merge the results, so the application layer must handle cross-shard sorting and deduplication. This means simply adding nodes does not automatically bring linear performance gains, and index design and shard key selection must be planned in advance, otherwise hot shards appear.
Business integration: because caching and vector retrieval share one instance, a user's recent behavior, hot rankings and vector indexes can be stored together, obtaining both a popularity score and a similarity score in one request for weighted ranking. This integration lowers the round-trip cost of cross-system calls, and it is the practical reason many recommendation chains choose it.
Application scenarios
Real-time recall in recommendation systems, in-site search suggestions, similar-question matching for online customer service, similar-behavior detection in anti-fraud, and the hot-data cache layer of RAG.