Comprehensive Guide to RediSearch: Features, Benchmarks, Installation, and Command Usage
RediSearch, a Redis module providing full-text search and secondary indexing, is introduced with its features, performance comparisons against Elasticsearch, benchmark results for index building and query throughput, detailed installation methods, and extensive command examples for creating, querying, updating, and managing indexes.
RediSearch is a Redis module that adds query, secondary indexing, and full-text search capabilities to Redis. To use RediSearch, you first declare an index on your Redis data and then query the data using the RediSearch query language.
RediSearch uses compressed inverted indexes for fast indexing with low memory usage, offering precise phrase matching, fuzzy search, numeric filtering, and more.
Key Features
Full-text indexing on multiple document fields
High‑performance incremental indexing
Document sorting (provided manually at index time)
Complex boolean queries with AND/NOT operators
Optional query clauses
Prefix searches
Field weight settings
Auto‑completion suggestions with fuzzy prefixes
Exact phrase search
Stemming‑based query expansion for many languages
Custom functions for query expansion and scoring
Field‑specific search limits
Numeric filters and ranges
Geospatial filtering using Redis geo commands
Unicode support (UTF‑8 required)
Retrieval of full documents or just IDs
Document deletion, updates, and index garbage collection
Partial updates and conditional document updates
Performance Comparison with Elasticsearch
In a benchmark, RediSearch built an index in 221 seconds versus Elasticsearch’s 349 seconds, a 58 % speed improvement.
For query performance, RediSearch achieved 12.5 K operations/second compared to Elasticsearch’s 3.1 K, roughly four times faster, with slightly lower latency (8 ms vs 10 ms).
Installation
Two installation methods are provided: source build and Docker.
git clone https://github.com/RediSearch/RediSearch.git
cd RediSearch
make setup
make installDocker installation:
docker run -p 6379:6379 redislabs/redisearch:latestVerify the module is loaded by running:
127.0.0.1:0> MODULE LISTSuccessful output includes entries such as "search" or "ft" indicating RediSearch is active.
Command‑Line Operations
1. Create an index
ft.create "student" SCHEMA "name" TEXT WEIGHT 5.0 "sex" TEXT "desc" TEXT "class" TAG2. Add a document
ft.add student 001 1.0 LANGUAGE "chinese" FIELDS name "张三" sex "男" desc "这是一个学生" class "一班"3. Basic search
FT.SEARCH student * SORTBY sex DESC RETURN 3 name sex desc4. Match query
ft.search student "张三" LIMIT 0 10 RETURN 3 name sex desc5. Fuzzy (postfix) search
ft.search student "李*" SORTBY sex DESC RETURN 3 name sex desc6. Field‑specific fuzzy search
ft.search student '@phone:185* @name:豆豆'7. Delete a document
ft.del student 0028. Drop an index
ft.drop student9. List all indexes
FT._LIST10. Retrieve a single document
ft.get student 00111. Retrieve multiple documents
ft.mget student 001 00212. Alias operations
FT.ALIASADD xs student
FT.ALIASDEL xsThe article concludes with a call to join the architecture community and a list of additional resources.
Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.