Valkey: Querying
This documentation is part of the Vector search and RAG guide. View the full 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 provides a host of benefits, including:
Valkey Adminweb UI included.- Unlimited message size and transfers.
- Effortless updates with just a click.
- Optimal performance and robust security powered by a private, dedicated infrastructure.
Save time and simplify your life: 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>"