Redis Enterprise Software - Operations and Administration Guide

open all | close all

RediSearch Quick Start Tutorial

For this quick start, you will need the following:

Add RediSearch Module to Redis Enterprise Software Cluster

Download the Module

To download this module, go to the Redis Enterprise downloads page. The module should be downloaded to wherever you use a browser to access the Redis Enterprise Software web UI.

Add Module to UI

  1. Log into the Redis Enterprise Software web UI
  2. Navigate to the settings -> redise modules
  3. Click on Add Module button and navigate to where you downloaded the module package
  4. Click on the Upload button and notice the name and version

Create a new database that uses the Module

  1. Navigate to databases tab
  2. Click on the + sign, if necessary, then create database
  3. On the create database screen, check the box for Redis Modules and select the module you want to use for this database.
  4. Click Show advanced options and put 12544 for the port.
  5. Click the activate button

Creating Indexes

Let’s create a new index called “myidx”. When you define the index, you must pass in the structure of the data you will be adding to the index. In this example, we have four things we input, the title, body, url, and value. In this example, we have three TEXT and one NUMERIC values. The title has a weight of 5.0.> FT.CREATE myIdx SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT value NUMERIC

Add info to test index

Now add some data to this index. We will add an object which key will be doc1 and then adds a title of “hello world”, body of “my favorite object”, and url of “” to the object as follows:> FT.ADD myIdx doc1 1.0 FIELDS title "hello world" body "My first object" url ""

Search the Index

Do a search on this index for any object with the word “first”:> FT.SEARCH myIdx "first" LIMIT 0 10
1) (integer) 1
2) "doc1"
3) 1) "title"
2) "hello world"
3) "body"
4) "My first object"
5) "url"
6) ""

Drop the Index

Now that we are done with it, we can drop the index.> FT.DROP myIdx

Auto-Complete and Search Engine Suggestions

Let’s add a suggestion for the search engine to use> FT.SUGADD autocomplete "hello world" 100
"(integer)" 1

Make sure the suggestion is there:> FT.SUGGET autocomplete "he"
1) "hello world"