Databases 14 min read

Why RediSearch Beats Elasticsearch: Features, Benchmarks, and Full‑Text Search Guide

This article introduces RediSearch—a Redis module for full‑text search—covers its rich feature set, shows benchmark comparisons with Elasticsearch for index building and query throughput, and provides step‑by‑step installation and command‑line usage examples for creating, querying, and managing indexes.

Su San Talks Tech
Su San Talks Tech
Su San Talks Tech
Why RediSearch Beats Elasticsearch: Features, Benchmarks, and Full‑Text Search Guide

Introduction

RediSearch is a Redis module that adds query, secondary indexing, and full‑text search capabilities. To use RediSearch you first declare an index on your Redis data, then query the data with RediSearch’s query language. It employs compressed inverted indexes for fast indexing while using little memory, and supports exact phrase matching, fuzzy search, numeric filtering, and more.

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‑based search

Field weight configuration

Autocomplete suggestions with fuzzy prefix support

Exact phrase search

Stem‑based query expansion for many languages

Custom functions for query expansion and scoring

Search limited to specific document fields

Numeric filters and ranges

Geospatial filtering using Redis geo commands

Unicode support (UTF‑8 required)

Retrieve full document content or only IDs

Document deletion, update, and index garbage collection

Partial updates and conditional document updates

Comparison with Elasticsearch

Index‑building time: RediSearch 221 seconds vs Elasticsearch 349 seconds, a 58 % speed‑up.

Index Build Test

A multi‑tenant e‑commerce simulation built 50 K indexes (each with up to 500 documents, total 25 M documents). RediSearch built the indexes in 201 seconds (≈125 K indexes/s). Elasticsearch crashed after 921 indexes, showing it is not designed for this load.

Query Performance Test

After indexing, 32 client threads issued two‑word search queries. RediSearch achieved 12.5 K ops/s throughput versus Elasticsearch’s 3.1 K ops/s (≈4× faster). Latency was slightly better: 8 ms average for RediSearch vs 10 ms for Elasticsearch.

Installation

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

Run 127.0.0.1:6379> module list and check that an entry with name “search” (or “ft”) and version 20209 appears, confirming the module is loaded.

Command‑line Operations

Create Index

Creating an index is similar to defining a table schema. Example:

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

The index name is student; fields name, sex, desc, and class are defined with their types. The weight parameter sets field importance (default 1.0).

Add Document

Adding a document is like inserting a row. Example (Chinese language, score 1.0):

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

Note that field names must be English; otherwise the parser throws “Fields must be specified in FIELD VALUE pairs”.

Search

Basic search

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

Match query

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

Limit works like MySQL pagination. Without the language "chinese" clause the query returns 0 results.

Fuzzy match (postfix)

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

Fuzzy search (Levenshtein distance)

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

RediSearch uses Levenshtein distance (max 3) for fuzzy matching, which is a similarity query rather than a true fuzzy search.

Field‑specific query

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

Delete Document

ft.del student 002

Drop Index

ft.drop student

List Indexes

FT._LIST

Get Document

ft.get student 001

Alias Operations

Add an alias: FT.ALIASADD xs student Delete an alias:

FT.ALIASDEL xs
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

CLIbenchmarkFull‑Text SearchRediSearch
Su San Talks Tech
Written by

Su San Talks Tech

Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.

0 followers
Reader feedback

How this landed with the community

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.