Application overview

This demo application lets us store users information and query them in a flexible way using RediSearch. The application consists of two parts:

  • A REST endpoint to initiate user data load: In a production application, the data load process for users (including name, email, city, and zip code) would be designed as a separate process that might run on a real-time basis in order to keep the data up to date. For the purposes of this lesson, the user data load is an ongoing process that can be triggered on demand with a REST endpoint. Once invoked, randomly generated user data is saved in a Redis hash (one for each user).

  • A REST endpoint to query user data: This endpoint provides the ability to search for users. Because we’re using RediSearch behind the scenes, the search criteria can be flexible. For example, we can have the ability to query by specific city, including the selected fields in the search results.

Code explanation

Let’s walk through the important parts of the code.

Imports

Here are some of the package imports:

Get hands-on with 1200+ tech skills courses.