openai-cookbook/examples/vector_databases/redis
2023-11-10 12:07:25 -05:00
..
redisjson Fix redisjson 2023-05-12 12:04:19 -06:00
redisqna Fix redisqna 2023-05-12 13:35:16 -06:00
docker-compose.yml Add docker-compose and cleanup 2023-02-14 13:05:41 -08:00
getting-started-with-redis-and-openai.ipynb revert: spelling adjustment in examples/ 2023-03-29 09:53:06 +08:00
nbutils.py Fix wget download updated parameters (#538) 2023-06-26 01:45:57 -07:00
README.md Changes and additions in response to PR comments 2023-05-16 12:56:57 -04:00
redis-hybrid-query-examples.ipynb Added embeddings_utils.py to utils directory, and updated references (#841) 2023-11-10 12:07:25 -05:00
redis.conf Add docker-compose and cleanup 2023-02-14 13:05:41 -08:00
Using_Redis_for_embeddings_search.ipynb Splitting Vector Databases into individual cookbooks (#529) 2023-06-28 01:37:01 -07:00

Redis

What is Redis?

Most developers from a web services background are probably familiar with Redis. At it's core, Redis is an open-source key-value store that can be used as a cache, message broker, and database. Developers choice Redis because it is fast, has a large ecosystem of client libraries, and has been deployed by major enterprises for years.

In addition to the traditional uses of Redis. Redis also provides Redis Modules which are a way to extend Redis with new capabilities, commands and data types. Example modules include RedisJSON, RedisTimeSeries, RedisBloom and RediSearch.

Deployment options

There are a number of ways to deploy Redis. For local development, the quickest method is to use the Redis Stack docker container which we will use here. Redis Stack contains a number of Redis modules that can be used together to create a fast, multi-model data store and query engine.

For production use cases, The easiest way to get started is to use the Redis Cloud service. Redis Cloud is a fully managed Redis service. You can also deploy Redis on your own infrastructure using Redis Enterprise. Redis Enterprise is a fully managed Redis service that can be deployed in kubernetes, on-premises or in the cloud.

Additionally, every major cloud provider (AWS Marketplace, Google Marketplace, or Azure Marketplace) offers Redis Enterprise in a marketplace offering.

What is RediSearch?

RediSearch is a Redis module that provides querying, secondary indexing, full-text search and vector search for Redis. To use RediSearch, you first declare indexes on your Redis data. You can then use the RediSearch clients to query that data. For more information on the feature set of RediSearch, see the RediSearch documentation.

Features

RediSearch uses compressed, inverted indexes for fast indexing with a low memory footprint. RediSearch indexes enhance Redis by providing exact-phrase matching, fuzzy search, and numeric filtering, among many other features. Such as:

  • Full-Text indexing of multiple fields in Redis hashes
  • Incremental indexing without performance loss
  • Vector similarity search
  • Document ranking (using tf-idf, with optional user-provided weights)
  • Field weighting
  • Complex boolean queries with AND, OR, and NOT operators
  • Prefix matching, fuzzy matching, and exact-phrase queries
  • Support for double-metaphone phonetic matching
  • Auto-complete suggestions (with fuzzy prefix suggestions)
  • Stemming-based query expansion in many languages (using Snowball)
  • Support for Chinese-language tokenization and querying (using Friso)
  • Numeric filters and ranges
  • Geospatial searches using Redis geospatial indexing
  • A powerful aggregations engine
  • Supports for all utf-8 encoded text
  • Retrieve full documents, selected fields, or only the document IDs
  • Sorting results (for example, by creation date)
  • JSON support through RedisJSON

Clients

Given the large ecosystem around Redis, there are most likely client libraries in the language you need. You can use any standard Redis client library to run RediSearch commands, but it's easiest to use a library that wraps the RediSearch API. Below are a few examples, but you can find more client libraries here.

Project Language License Author Stars
jedis Java MIT Redis Stars
redis-py Python MIT Redis Stars
node-redis Node.js MIT Redis Stars
nredisstack .NET MIT Redis Stars

Deployment Options

There are many ways to deploy Redis with RediSearch. The easiest way to get started is to use Docker, but there are are many potential options for deployment such as

Cluster support

RediSearch has a distributed cluster version that scales to billions of documents across hundreds of servers. At the moment, distributed RediSearch is available as part of Redis Enterprise Cloud and Redis Enterprise Software.

See RediSearch on Redis Enterprise for more information.

Examples

More Resources

For more information on how to use Redis as a vector database, check out the following resources: