Need help with redisearch-py?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

152 Stars 52 Forks BSD 2-Clause "Simplified" License 183 Commits 21 Opened issues


RediSearch python client

Services available


Need anything else?

Contributors list

license PyPI version CircleCI GitHub issues Codecov Known Vulnerabilities Total alerts

RediSearch Python Client

Forum Discord

This is a Python search engine library that utilizes the RediSearch Redis Module API.

It is the "official" client of RediSearch, and should be regarded as its canonical client implementation.


RediSearch is a source avaliable (RSAL), high performance search engine implemented as a Redis Module. It uses custom data types to allow fast, stable and feature rich full-text search inside Redis.

This client is a wrapper around the RediSearch API protocol, that allows you to utilize its features easily.

RediSearch's features include:

  • Full-Text indexing of multiple fields in documents.
  • Incremental indexing without performance loss.
  • Document ranking (provided manually by the user at index time) and field weights.
  • Auto-complete suggestions (with fuzzy prefix suggestions).
  • Exact Phrase Search.
  • Stemming based query expansion in many languages (using Snowball).
  • Limiting searches to specific document fields (up to 8 fields supported).
  • Numeric filters and ranges.
  • Automatically index existing HASH keys as documents.

For more details, visit

Example: Using the Python Client

from redisearch import Client, TextField, IndexDefinition, Query

Creating a client with a given index name

client = Client("myIndex")

IndexDefinition is available for RediSearch 2.0+

definition = IndexDefinition(prefix=['doc:', 'article:'])

Creating the index definition and schema

client.create_index((TextField("title", weight=5.0), TextField("body")), definition=definition)

Indexing a document for RediSearch 2.0+

client.redis.hset('doc:1', mapping={ 'title': 'RediSearch', 'body': 'Redisearch impements a search engine on top of redis' })

Indexing a document for RediSearch 1.x

client.add_document( "doc:2", title="RediSearch", body="Redisearch implements a search engine on top of redis", )

Simple search

res ="search engine")

the result has the total number of results, and a list of documents

print( # "2" print([0].title) # "RediSearch"

Searching with complex parameters:

q = Query("search engine").verbatim().no_content().with_scores().paging(0, 5) res =


  1. Install RediSearch
  2. Install the Python client:
$ pip install redisearch


Testing can easily be performed using using Docker. Run the following:

make -C test/docker test PYTHON_VER=3


to test with Python 2.7.)

Alternatively, use the following procedure:

First, run:

PYTHON_VER=3 ./test/

This will set up a Python virtual environment in

(or in
is used).

Afterwards, run RediSearch in a container as a daemon:

docker run -d -p 6379:6379 redislabs/redisearch:2.0.0

Finally, invoke the virtual environment and run the tests:

. ./venv3/bin/activate
REDIS_PORT=6379 python test/ 
REDIS_PORT=6379 python test/

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.