For developersIndexing and Querying
#Introduction
Conceptually, Redis is based on the key-value database paradigm. Every piece of data is associated with a key, either directly or indirectly. If you want to retrieve data based on anything besides the key, you’ll need to implement an index that leverages one of the many data types available in Redis.
You have various ways to create index using Redis core data structures, for example:
- Sorted sets to create secondary indexes by ID or other numerical fields.
- Sorted sets with lexicographical ranges for creating more advanced secondary indexes, composite indexes and graph traversal indexes.
- Sets for creating random indexes.
- Lists for creating simple iterable indexes and last N items indexes.
When using these data structures you must create your own API to keep the index up-to-date. To simplify and automate this task, Redis has Search that allows indexing and querying.
#Indexing and Querying with Redis Search
The easiest way to index and query data in Redis is to use Redis Search.
You can follow the Redis quick start to learn more about it.