Databases 13 min read

RediSearch Overview: Features, Benchmarks, Installation, and Command‑Line Operations

This article introduces RediSearch—a Redis module for full‑text search—detailing its features, performance comparison with Elasticsearch, index‑building and query benchmarks, installation methods (source and Docker), and comprehensive command‑line examples for creating, querying, updating, and managing indexes.

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

1. Introduction

RediSearch is a Redis module that adds query, secondary indexing and full‑text search capabilities to Redis. Users first declare an index on Redis data and then query it using the RediSearch query language.

It uses compressed inverted indexes for fast indexing with low memory consumption and provides features such as exact phrase matching, fuzzy search and numeric filtering.

2. Features

Document‑level multi‑field full‑text indexing

High‑performance incremental indexing

Custom document sorting (provided manually at index time)

Complex boolean queries with AND / NOT operators

Optional query clauses

Prefix search

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 search

Numeric filters and ranges

Geospatial filtering using Redis geo commands

Unicode support (UTF‑8)

Retrieve full document or only IDs

Document deletion, update and index garbage collection

Partial updates and conditional document updates

3. Comparison with Elasticsearch

In the benchmark shown, RediSearch builds the index in 221 seconds while Elasticsearch takes 349 seconds, a 58 % speed improvement.

4. Index Build Test

A multi‑tenant e‑commerce scenario was simulated with 50 K indexes (each representing a product category) holding up to 500 documents each, for a total of 25 million documents.

RediSearch built all indexes in 201 seconds (≈125 K indexes per second). Elasticsearch crashed after 921 indexes, indicating it is not designed for this load.

5. Query Performance Test

After indexing, 32 client threads issued two‑word search queries. RediSearch achieved a throughput of 12.5 K ops/s, whereas Elasticsearch reached only 3.1 K ops/s – a four‑fold increase.

Latency was also slightly better: 8 ms average for RediSearch versus 10 ms for Elasticsearch.

6. Installation

Source installation

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

Docker installation

Because the source package is difficult to compile, Docker is recommended.

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"

If the returned array contains “ft” or “search”, the RediSearch module is loaded successfully.

7. Command‑line Operations

7.1 Create Index

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

The index name (student) corresponds to a table name; fields are defined with their types. The optional weight defaults to 1.0.

7.2 Add Document

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

Document ID is 001, score is 1.0. The language flag must be set to “chinese” for Chinese tokenisation.

7.3 Query

Full‑text query

FT.SEARCH student * SORTBY sex desc RETURN 3 name sex desc

Match query

ft.search student "张三" limit 0 10 RETURN 3 name sex desc

Postfix fuzzy query

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

Levenshtein fuzzy query

FT.SEARCH idx "%%张店%%"

Uses Levenshtein distance (max 3) for approximate matching.

7.4 Delete

ft.del student 002

7.5 Drop Index

ft.drop student

7.6 View Indexes and Documents

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

7.7 Alias Operations

FT.ALIASADD xs student
FT.ALIASDEL xs

An alias allows multiple names to refer to the same index.

CLIIndexingRedisBenchmarkFull-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.