Quick Start Guide for RediSearch:

Running with Docker

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

Building and running from source:

  1. git clone https://github.com/RedisLabsModules/RediSearch.git
  2. cd RediSearch/src
  3. make all
  4. # Assuming you have a redis build from the unstable branch:
  5. /path/to/redis-server --loadmodule ./redisearch.so

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

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

Adding documents to the index:

  1. 127.0.0.1:6379> FT.ADD myIdx doc1 1.0 FIELDS title "hello world" body "lorem ipsum" url "http://redis.io"
  2. OK

Searching the index:

  1. 127.0.0.1:6379> FT.SEARCH myIdx "hello world" LIMIT 0 10
  2. 1) (integer) 1
  3. 2) "doc1"
  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.DROP 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"