Skip to content

redislabs-training/ru201

Repository files navigation

Redis University RU201, RediSearch

Course Retired

This course has been retired, and replaced with RU203, Querying, Indexing, and Full-Text Search. Sign up for RU203.


Introduction

This repo contains the sample data and Node.js load script for RU201, RediSearch at Redis University.

Setup

Redis

Node.js

To install the script that loads the sample data into RediSearch, you'll need npm and Node.js 8.11+. To get the dependencies use:

$ npm install

in this directory.

Configuration

First, you will need to create a simple JSON file for your connection credentials. This connection file is based on the node_redis config object allowing you specify host, password, port, etc. In the most basic configuration you would have just these:

{
  "host"  : "localhost",
  "port"  : 6379
}

Remember: don't commit your copy of this file to your fork of this repo if it contains sensitive credentials.

Running

The index.js script will create the schema and database for you from a CSV file (provided).

When running you'll need to specify:

  • source Required. The CSV file which will be ingested. General_Building_Permits.csv is included
  • connection Required. The path to your configuration file.
  • drop Optional. This will drop the existing permits schema.
  • totaldocs Optional. This will give you an accurate progress bar. The provided CSV has 121,828 docs

Example:

$ node index.js --source ./General_Building_Permits.csv --connection ./connection.json --drop --totaldocs 121828

The output should look something like this:

Created index. Starting ingest.
Ingested: 121828 documents.
Ingested 121828 documents in 15 seconds. Average rate 8122 docs/sec.

Confirmation

You can check you have the right data by trying the following search from the redis-cli

127.0.0.1:6379> ft.search permits garage limit 0 0
1) (integer) 49488

Data

The data file provided (General_Building_Permits.csv) is pulled from the Edmonton Open Data Portal and is the General Building Permits dataset pulled on May 16, 2018. This dataset is frequently updated, however we've frozen the data set in this course to provided a consistent course experience.

Subscribe to our YouTube Channel

We'd love for you to check out our YouTube channel, and subscribe if you want to see more Redis videos!