Valkey: Querying
This documentation is part of the Vector search and RAG guide. You can view the complete guide here: Semantic search, recommendations, and retrieval-augmented generation with Valkey.
👋 Welcome to the Stackhero documentation!
Stackhero provides a ready-to-use Valkey cloud solution offering numerous advantages, including:
- Redis Commander web interface included.
- Unlimited message size and transfers.
- One-click simplified updates.
- Optimal performance and enhanced security thanks to a private, dedicated infrastructure.
Save time and make your life easier: it only takes 5 minutes to try Stackhero's Valkey cloud hosting solution!
A K-nearest neighbours (KNN) query passes the vector as a parameter, using raw little-endian float32 bytes:
FT.SEARCH chunksIndex "*=>[KNN 5 @embedding $queryVector]"
PARAMS 2 queryVector "<rawBytes>"
To combine vector search with filters, simply replace the * with your filter expression:
FT.SEARCH chunksIndex "@documentId:{doc42}=>[KNN 5 @embedding $queryVector]"
PARAMS 2 queryVector "<rawBytes>"