Databases 12 min read

RediSearch: Features, Benchmarks, Installation, and Command‑Line Usage

This article introduces RediSearch, a Redis module for full‑text search, outlines its extensive feature set, compares its indexing and query performance with Elasticsearch, and provides detailed installation steps and command‑line examples for creating, querying, updating, and managing indexes.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
RediSearch: Features, Benchmarks, Installation, and Command‑Line Usage

RediSearch is a Redis module that adds full‑text search, secondary indexing, and advanced query capabilities to Redis.

Features

Document‑level multi‑field full‑text indexing

High‑performance incremental indexing

Custom document sorting

Complex Boolean queries with AND/NOT operators

Optional query clauses

Prefix searches

Field‑weight support

Autocomplete suggestions with fuzzy prefixes

Exact phrase search

Stemming‑based query expansion for many languages

Custom functions for query expansion and scoring

Field‑restricted searches

Numeric filters and ranges

Geospatial filtering using Redis geo commands

Unicode support (UTF‑8)

Retrieval of full documents or just IDs

Document deletion, update, and index garbage collection

Partial and conditional document updates

Comparison with Elasticsearch

In benchmark tests RediSearch built indexes in 221 seconds versus Elasticsearch’s 349 seconds, a 58 % speed improvement.

Index Build Test

A simulated multi‑tenant e‑commerce scenario created 50 K indexes (each representing a product category) with up to 500 documents each, totaling 25 million documents. RediSearch completed the build in 201 seconds (≈125 K indexes per second), while Elasticsearch crashed after 921 indexes.

Query Performance Test

After indexing, 32 client threads issued two‑word search queries. RediSearch achieved a throughput of 12.5 K ops/s with an average latency of 8 ms, compared to Elasticsearch’s 3.1 K ops/s and 10 ms latency.

Installation

RediSearch can be installed from source or via Docker.

Source Installation

git clone https://github.com/RediSearch/RediSearch.git
cd RediSearch # enter module directory
make setup
make install

Docker Installation

docker run -p 6379:6379 redislabs/redisearch:latest

Verify Installation

127.0.0.1:0>module list
1) 1) "name"
   2) "ReJSON"
   3) "ver"
   4) "20007"

2) 1) "name"
   2) "search"
   3) "ver"
   4) "20209"

# The presence of "ft" or "search" indicates the RediSearch module is loaded.

Command‑Line Operations

1. Create Index

Creating an index is analogous to defining a table schema.

ft.create "student" schema "name" text weight 5.0 "sex" text "desc" text "class" tag
"OK"

2. Add Document

ft.add student 001 1.0 language "chinese" fields name "张三" sex "男" desc "这是一个学生" class "一班"
"OK"

3. Query

Full‑text and filtered queries:

FT.SEARCH student * SORTBY sex desc RETURN 3 name sex desc
ft.search student "张三" limit 0 10 RETURN 3 name sex desc

Fuzzy (postfix) match:

ft.search student "李*" SORTBY sex desc RETURN 3 name sex desc

Levenshtein‑based fuzzy match (using % symbols):

FT.SEARCH beers "%%张店%%"

4. Delete Document / Index

ft.del student 002
"1"
ft.drop student
"OK"

5. View Indexes and Documents

FT._LIST
ft.get student 001
ft.mget student 001 002

6. Index Alias Operations

FT.ALIASADD xs student
"OK"
FT.ALIASDEL xs
"OK"

The article also includes several benchmark images illustrating the performance differences.

CLIDatabaseRedisBenchmarkInstallationFull-Text SearchRediSearch
Selected Java Interview Questions
Written by

Selected Java Interview Questions

A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.