Quick Start Guide for RediSearch

Learn about RediSearch using this Getting Started Tutorial . This tutorial will guide you throught various examples including an application that uses RediSearch Java, Python and Node.js clients.

Redis Cloud

RediSearch is available on all Redis Cloud managed services. Redis Cloud Essentials offers a completely free managed databases up to 30MB.

Get started here

Running with Docker

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

Download and running binaries

First download the pre-compiled version from RedisLabs download center .

Next, run Redis with RediSearch:

  1. $ redis-server --loadmodule /path/to/module/src/redisearch.so

Building and running from source

First, clone the git repo (make sure not to omit the --recursive option, to properly clone submodules):

  1. git clone --recursive https://github.com/RediSearch/RediSearch.git

Next, install dependencies and build:

  1. sudo make setup
  2. make build

Finally, run Redis with RediSearch:

  1. make run

For more elaborate build instructions, see the Development page .

Creating an index with fields and weights (default weight is 1.0)

  1. 127.0.0.1:6379> FT.CREATE myIdx ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT
  2. OK

Adding documents to the index

  1. 127.0.0.1:6379> hset doc:1 title "hello world" body "lorem ipsum" url "http://redis.io"
  2. (integer) 3

Searching the index

  1. 127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10
  2. 1) (integer) 1
  3. 2) "doc:1"
  4. 3) 1) "title"
  5. 2) "hello world"
  6. 3) "body"
  7. 4) "lorem ipsum"
  8. 5) "url"
  9. 6) "http://redis.io"

Note

Input is expected to be valid utf-8 or ASCII. The engine cannot handle wide character unicode at the moment.

Dropping the index

  1. 127.0.0.1:6379> FT.DROPINDEX myIdx
  2. OK

Adding and getting Auto-complete suggestions

  1. 127.0.0.1:6379> FT.SUGADD autocomplete "hello world" 100
  2. OK
  3. 127.0.0.1:6379> FT.SUGGET autocomplete "he"
  4. 1) "hello world"