RediSearch quick start

Get started with RediSearch

Set up RediSearch

There are several ways to set up a Redis database with the RediSearch module enabled.

Redis Cloud

RediSearch is available on all Redis Cloud managed services. A Redis Cloud Fixed subscription offers a completely free managed database with up to 30MB.

Create a free Redis Cloud account here and select Redis Stack as your database type. For more detailed instructions, see the Redis Stack and modules quick start.

Run with Docker

To run RediSearch with Docker, use the redis-stack-server Docker image:

$ docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest

For more information about running Redis Stack in a Docker container, see Run Redis Stack on Docker.

Download binaries

To download and run RediSearch from a precompiled binary:

  1. Download a precompiled version of RediSearch from the Redis download center.

  2. Run Redis with RediSearch:

    $ redis-server --loadmodule /path/to/module/src/

Build from source

To build and run RediSearch from the source code:

  1. Requirements: git & make

  2. Clone the RediSearch repository (make sure you include the --recursive option to properly clone submodules):

    $ git clone --recursive
    $ cd RediSearch
  3. Install dependencies:

    $ make setup
  4. Build:

    $ make build
  5. Run Redis with RediSearch: Requirements: redis-server

    $ make run

For more elaborate build instructions, see the Development page.

Create an index

Use the FT.CREATE command to create an index with fields and weights (default weight is 1.0):> FT.CREATE myIdx ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT

Any existing hash documents that have a key prefixed with doc: are automatically added to the index at this time.

Add documents

After you create the index, any new hash documents with the doc: prefix are automatically indexed upon creation.

Use the HSET command to create a new hash document and add it to the index:> HSET doc:1 title "hello world" body "lorem ipsum" url ""
(integer) 3

Search the index

To search the index for documents that contain specific words, use the FT.SEARCH command:> FT.SEARCH myIdx "hello world" LIMIT 0 10
1) (integer) 1
2) "doc:1"
3) 1) "title"
   2) "hello world"
   3) "body"
   4) "lorem ipsum"
   5) "url"
   6) ""

FT.SEARCH expects valid UTF-8 or ASCII as input. The engine cannot handle wide character unicode.

Drop the index

To remove the index without deleting the associated hash documents, run FT.DROPINDEX without the DD option:> FT.DROPINDEX myIdx

To delete the index and all indexed hash documents, add the DD option to the command:> FT.DROPINDEX myIdx DD


Add an auto-complete suggestion with FT.SUGADD:> FT.SUGADD autocomplete "hello world" 100
(integer) 1

Test auto-complete suggestions with FT.SUGGET:> FT.SUGGET autocomplete "he"
1) "hello world"

Index JSON documents

In addition to Redis hashes, you can index and search JSON documents if your database has both RediSearch and RedisJSON enabled. If you have a Redis Stack database, it automatically includes both modules.

To learn how to use RediSearch with JSON documents, see Indexing JSON documents.


If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.