Hands-on task
Searching hashes: the Query Engine
Redis holds products — hashes product:1 … product:24 with the fields name (the title), category (a single category tag) and price (an integer).
- Create an index
idx:productsover hashes with the prefixproduct:and the schema:name—TEXT,category—TAG,price—NUMERIC. - Using the index, find all products in the category exactly
bookswith a price no more than 500 (500 inclusive), sorted by price ascending. - Write the keys of the products found to
/root/books.txt— one per line, in sort order, with no other lines.
- redis
- Query Engine
- RediSearch
- FT.CREATE
- FT.SEARCH
- FT.INFO
- TAG
- NUMERIC