In the previous steps you used only a few movies, let's now import:
- More movies to discover more queries.
- Theaters to discover the geospatial capabilities.
- Users to do some aggregations.
sample-app/redisearch-docker/dataset/import_movies.redis is a script that creates 922 Hashes.
The movie hashes contain the following fields.
movie:id: The unique ID of the movie, internal to this database (used as the key of the hash)
title: The title of the movie.
plot: A summary of the movie.
genre: The genre of the movie, for now a movie will only have a single genre.
release_year: The year the movie was released as a numerical value.
rating: A numeric value representing the public's rating for this movie.
votes: Number of votes.
poster: Link to the movie poster.
imdb_id: id of the movie in the IMDB database.
sample-app/redisearch-docker/dataset/import_theaters.redis is a script that creates 117 Hashes (used for Geospatial queries). This dataset is a list of New York Theaters, and not movie theaters, but it is not that critical for this project ;).
The theater hashes contain the following fields.
theater:id: The unique ID of the theater, internal to this database (used as the key of the hash)
name: The name of the theater
address: The street address
city: The city, in this sample dataset all the theaters are in New York
zip: The zip code
phone: The phone number
url: The URL of the theater
location: Contains the
longitude,latitudeused to create the Geo-indexed field
sample-app/redisearch-docker/dataset/import_users.redis is a script that creates 5996 Hashes.
The user hashes contain the following fields.
user:id: The unique ID of the user.
first_name: The first name of the user.
last_name: The last name of the user.
gender: The gender of the user (
country: The country name of the user.
country_code: The country code of the user.
city: The city of the user.
longitude: The longitude of the user.
latitude: The latitude of the user.
last_login: The last login time for the user, as EPOC time.
ip_address: The IP address of the user.
Before importing the data, flush the database:
The easiest way to import the file is to use the
redis-cli, using the following terminal command:
Using Redis Insight or the
redis-cli you can look at the dataset:
You can also use the
DBSIZE command to see how many keys you have in your database.
The movies have now been indexed, you can run the
FT.INFO "idx:movie" command and look at the
num_docs returned value. (should be 922).
This index will mostly be used to show the geospatial capabilties of RediSearch.
In the previous examples we have created indexes with 3 types:
You will now discover a new type of field:
theater hashes contains a field
location with the longitude and latitude, that will be used in the index as follows:
The theaters have been indexed, you can run the
FT.INFO "idx:theater" command and look at the
num_docs returned value. (should be 117).