FT.CREATE idx ON HASH PREFIX 1 product: SCHEMA name TEXT price NUMERIC
FT.SEARCH idx 'laptop'
Topics
40
Caching Patterns
Cluster Sharding & Hash Slots
Clustering
Connection Pooling & Client Libraries
Data Types
Distributed Locks with Redis
Expiration & Eviction
Geospatial Data in Redis
Hashes in Redis
HyperLogLog in Redis
Keyspace Notifications
Leaderboards with Sorted Sets
Lists in Redis
Lua Scripting
Persistence (RDB/AOF)
Pub/Sub
Rate Limiting with Redis
Redis Architecture & Installation
Redis as a Message Queue
Redis Backup & Disaster Recovery
Redis CLI & Basic Commands
Redis Memory Optimization
Redis Modules Overview
Redis Monitoring & Observability
Redis Performance Tuning & Benchmarking
Redis Replication
Redis Security & ACL
Redis Sentinel & High Availability
Redis vs Memcached
Redis with Docker & Kubernetes
RedisBloom (Probabilistic Data Structures)
RedisJSON
RedisSearch (Full Text Search)
RedisTimeSeries
Session Management with Redis
Sets & Sorted Sets in Redis
Streams
Strings & Bitmaps in Redis
TLS & Encryption in Redis
Transactions
RedisSearch (Full Text Search)
7 questions found
RedisSearch adds powerful indexing and querying capabilities to Redis, letting you perform full text search, filter and sort by numeric or tag fields, and run complex queries across your data directly within Redis, capabilities that go well beyond what Redis's core commands alone can provide.
Real-world example
An online store adds RedisSearch to their existing Redis deployment, gaining the ability to let customers search for products by name while also filtering by price range, all within the same Redis instance already used for caching.
RedisJSON;Redis Modules Overview
How do you create a search index in RedisSearch, and what does defining a schema for that index actually do?
BeginnerYou use the FT.CREATE command, specifying which keys to index based on a prefix pattern and defining a schema that maps specific fields within your data to search field types like TEXT for full text searchable content, NUMERIC for range queries, or TAG for exact match filtering, telling RedisSearch exactly how to index and later let you query each field.
FT.CREATE product_idx ON HASH PREFIX 1 product: SCHEMA name TEXT price NUMERIC category TAG
Real-world example
A product catalog defines a search index specifying that the name field should support full text search, the price field should support numeric range queries, and the category field should support exact tag based filtering.
Data Types;Hashes in Redis
How do you write a RedisSearch query that combines full text search with a numeric range filter?
IntermediateYou use the FT.SEARCH command with a query string that includes your text search terms alongside a numeric filter expression targeting a specific field, using syntax like an at sign followed by the field name and a range in square brackets, letting you combine text relevance search with precise numeric filtering in a single query.
FT.SEARCH product_idx '@name:laptop @price:[500 1500]'
Real-world example
An online store lets customers search for laptops specifically within their budget range, combining a text search for the word laptop with a numeric filter restricting results to products priced between five hundred and fifteen hundred dollars.
Data Types;RedisSearch (Full Text Search)
You add the SORTBY clause to your search query specifying the field to sort by and the direction, and use the LIMIT clause to specify a starting offset and the maximum number of results to return, letting you build a typical paginated search results experience directly using RedisSearch's built-in capabilities.
FT.SEARCH product_idx '@category:{electronics}' SORTBY price ASC LIMIT 0 20
Real-world example
A product search page displays the first twenty electronics products sorted by ascending price, using RedisSearch's built-in sorting and pagination features to efficiently retrieve exactly the results needed for that specific page.
Data Types;Redis Performance Tuning & Benchmarking
How would you design a RedisSearch based product search feature that supports faceted filtering, such as showing available categories and their counts alongside search results?
AdvancedYou would use RedisSearch's aggregation capabilities through the FT.AGGREGATE command, grouping matched results by category and counting occurrences within each group, letting you display both the actual search results and a summary of available filter categories with counts, similar to what you commonly see on major e-commerce search pages.
FT.AGGREGATE product_idx '@name:laptop' GROUPBY 1 @category REDUCE COUNT 0 AS count
Real-world example
An e-commerce search results page shows customers not just matching products but also a sidebar listing each available category along with how many matching products exist in each one, powered by a RedisSearch aggregation query.
RedisJSON;Redis Modules Overview
What are the memory and performance tradeoffs of adding RedisSearch indexes to a large existing dataset in Redis?
AdvancedSearch indexes require additional memory beyond the original data itself, roughly proportional to how many fields you index and how large your text content is, and while search queries are generally very fast, indexing overhead adds to every write operation on indexed data, meaning it is important to only index the specific fields you actually need to search or filter on rather than indexing everything by default.
-- Index only the fields actually needed for search
-- rather than every single field in the document
FT.CREATE idx ON HASH PREFIX 1 doc: SCHEMA searchable_field TEXT
Real-world example
A team adding RedisSearch to an existing large dataset carefully selects only the specific fields customers actually need to search or filter by, avoiding unnecessary memory overhead from indexing fields that will never actually be queried.
Redis Memory Optimization;Redis Performance Tuning & Benchmarking
How do you update or delete a RedisSearch index without affecting the underlying data it was built from?
IntermediateYou use FT.DROPINDEX to remove an index definition, with the option to also delete the underlying documents if desired or leave them intact if you plan to recreate the index later, and to change an index's schema you typically need to drop and recreate it with the new field definitions, since RedisSearch does not support modifying an existing field's type directly.
FT.DROPINDEX product_idx
FT.CREATE product_idx ON HASH PREFIX 1 product: SCHEMA name TEXT price NUMERIC brand TAG
Real-world example
A team needing to add a new searchable field to their product index drops the existing index definition and recreates it with the updated schema, while their actual underlying product data in Redis remains completely untouched throughout the process.
Redis CLI & Basic Commands;Data Types