Databases 13 min read

RediSearch: Introduction, Features, Benchmarks, Installation, and CLI Operations

This article introduces RediSearch, a Redis module for full‑text search, outlines its many features, compares its indexing and query performance with Elasticsearch, provides installation methods (source and Docker), and demonstrates command‑line operations for creating indexes, adding documents, searching, and managing indexes.

Java Captain
Java Captain
Java Captain
RediSearch: Introduction, Features, Benchmarks, Installation, and CLI Operations

RediSearch is a Redis module that adds query, secondary indexing, and full‑text search capabilities to Redis. To use it, an index must first be declared on the Redis data, after which the RediSearch query language can be used for searches. The module employs compressed inverted indexes for fast, memory‑efficient indexing and supports exact phrase matching, fuzzy search, numeric filtering, and more.

Key features include:

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 configuration

Auto‑completion with fuzzy prefix suggestions

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' native geo commands

Unicode support (UTF‑8 required)

Retrieval of full documents or just IDs

Document deletion, update, and index garbage collection

Partial and conditional document updates

Comparison with Elasticsearch

Benchmark results show RediSearch builds an index in 221 seconds versus Elasticsearch’s 349 seconds (58 % faster). In a simulated multi‑tenant e‑commerce scenario with 50 K indexes (250 M documents total), RediSearch completed indexing in 201 seconds, while Elasticsearch crashed after 921 indexes.

For query performance, 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

Source installation:

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

Docker installation (recommended because the original package is difficult to compile):

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

Verify the module is loaded by running:

127.0.0.1:0> module list
1) 1) 'name' 2) 'search' 3) 'ver' 4) '20209'

Presence of "search" (or "ft") in the output confirms successful loading.

Command‑line operations

Creating an index (analogous to defining a table schema):

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

Adding a document (similar to inserting a row):

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

Basic search examples:

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

Fuzzy (postfix) search:

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

Field‑specific queries and boolean logic are also supported, e.g.:

ft.search student '@phone:185* @name:豆豆'

Deleting a document or an index :

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

Viewing indexes and documents :

FT._LIST
FT.GET student 001
FT.MGET student 001 002

Alias operations (adding, modifying, deleting):

FT.ALIASADD xs student
'OK'
FT.ALIASDEL xs
'OK'

These commands illustrate how RediSearch can be used for creating searchable indexes, inserting and retrieving documents, performing exact, fuzzy, and numeric queries, and managing indexes through aliases.

CLIRedisbenchmarkInstallationFull-Text SearchRediSearch
Java Captain
Written by

Java Captain

Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.

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.