...

/

Introduction to Vector Search in Redis

Introduction to Vector Search in Redis

Understand how Redis supports vector search using different commands, indexes, data types and query formats.

Redis is an open-source, in-memory data structure. It belongs to the NoSQL category of databases and falls under the key-value database umbrella. Redis’ core data types include String, List, Hash, Set, and Sorted Set. Redis also has specialized features such as Redis Streams, Pub/Sub, Geospatial indexes, HyperLogLog, etc. Although it’s an in-memory store, we can choose from a spectrum of persistence options.

Press + to interact

At a high level, using Redis as a vector store involves the following:

  1. Load (or Index) vector data using Redis hashes or in the form of JSON documents (using JSON module).

  2. Execute vector similarity queries using the FT.SEARCH command.

Like many vector databases, Redis supports three distance metrics – cosine, Euclidean, and inner (Dot) product.

Redis vector search commands

Here are some of the most commonly used commands when using vector search capability in Redis:

  • FT.CREATE: It is used to define and build an index for vector searches.

  • FT.SEARCH: It executes vector similarity searches within a previously defined index.

  • FT.INFO: It returns information and statistics on the index.

  • FT.AGGREGATE: It runs a search query on an index and performs aggregate transformations on the results, extracting statistics (and more) from them.

  • FT.DROPINDEX: It is used to delete an index.

Indexing

Redis supports two index types: ...