Learn / Lessons

What is a vector database?

How do you search for what a sentence means, not just the words it uses? A keyword search looks for the same words.

Chapters

  1. 0:00Introduction
  2. 0:06The difference: Words or meaning
  3. 0:14A vector: Meaning as numbers
  4. 0:24What's inside: What gets stored
  5. 0:36Searching: Find the nearest
  6. 0:46Speed: Why it's fast
  7. 0:59Best of both: Hybrid search
  8. 1:07Look after it: Keep it healthy
  9. 1:18Wrap up
Read the transcript

Introduction

How do you search for what a sentence means, not just the words it uses?

The difference: Words or meaning

A keyword search looks for the same words. A vector search looks for similar meaning, so car can find automobile.

A vector: Meaning as numbers

An embedding model reads a piece of text. It gives back a long list of numbers, called a vector. Texts that mean similar things get similar numbers.

What's inside: What gets stored

Each entry holds the vector. It keeps details with it, such as the title and page. And an identifier, so you can update or delete it. Entries are grouped into collections.

Searching: Find the nearest

Your question becomes a vector too. The database finds the closest ones. Filters can narrow it, for example to one year or one folder.

Speed: Why it's fast

Comparing against every entry gets slow. An index lets the database look in the likely places. It trades a tiny bit of exactness for a lot of speed. And you can tune that trade.

Best of both: Hybrid search

Many systems combine both kinds of search. Keywords catch exact names and numbers. Vectors catch meaning.

Look after it: Keep it healthy

Use the same embedding model for storing and searching. Change the model, and you embed again. Protect it with a key. And back it up with snapshots.

Wrap up

Text becomes numbers, and the nearest numbers mean the nearest ideas.

Sources

More lessons