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 offers a ready-to-use Valkey cloud solution that delivers numerous advantages, including:
Valkey Adminweb UI included.- Unlimited message size and transfers.
- One-click updates for easy maintenance.
- 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 neighbors (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>"