LESSON 34 ยท VECTOR DATABASES

Qdrant

Qdrant is a vector database designed for storing embeddings, searching vectors by similarity, and combining vector retrieval with structured metadata filters. It is especially useful for semantic search and RAG applications.

35 min readโ€ขBeginnerโ€ขGenerative AI

By the end of this lesson, you will be able to:

  • Explain what Qdrant is and how it differs from a local vector index such as FAISS.
  • Understand collections, points, vectors, payloads, and similarity search.
  • Connect to Qdrant from Python and create a collection.
  • Insert vectors with useful metadata and run a filtered search.
  • Understand how Qdrant fits into a semantic-search and RAG pipeline.
  • Choose when a managed or self-hosted vector database is more appropriate than a local index.
1

What Is Qdrant?

Qdrant is a vector database built around similarity search. It stores vectors together with payload data and lets applications retrieve the most relevant points using vector similarity and filters.

VECTOREmbedding

A numerical representation of text, images, or other content.

โ†’
QDRANTCollection + search

Stores vectors and payloads and finds relevant points.

โ†’
APPLICATIONRetrieved context

Uses the returned records for search, recommendations, or RAG.

Important:Qdrant is more than a vector index. It provides database-oriented storage and retrieval capabilities around vectors and their associated payloads.
2

Qdrant vs FAISS

FAISS and Qdrant can both help you perform vector similarity search, but they solve different layers of the problem.

FAISS

Similarity-search library

Great for local experiments, research, and applications that manage their own persistence and metadata mapping.

QDRANT

Vector database

Provides collections, persistent records, payloads, filtering, and database-style access around vector retrieval.

Simple mental model: FAISS is primarily a search engine component you embed into your application. Qdrant is a database service your application can use as a vector retrieval layer.
3

Core Qdrant Concepts

CollectionA named group of points that share a vector configuration.
PointA stored record identified by an ID and containing vector data and optional payload.
VectorThe numerical embedding used for similarity search.
PayloadStructured metadata stored alongside a point, such as title, category, source, or tenant.
QueryA vector or query representation used to retrieve nearby points.
FilterConditions that restrict which payload records can participate in retrieval.
4

How a Qdrant Collection Looks

POINT 101Vector

[0.12, -0.41, 0.78, ...]

PAYLOADMetadata

title, category, language, source

SEARCHResult

Score + point ID + payload

Keeping metadata with the vector is important because retrieval usually needs more than a numerical score. Your application may need the document title, source URL, tenant, permissions, or other fields before showing or generating an answer.

5

Python: Connect to Qdrant

For local development, Qdrant can run as a service and the Python client can connect to it. The exact URL depends on how you deploy Qdrant.

</> Python
from qdrant_client import QdrantClient

client = QdrantClient(
    url="http://localhost:6333"
)

print(client.get_collections())
Local setup:Port 6333 is commonly used by a local Qdrant HTTP endpoint. If your deployment uses another host, port, or API key, update the client configuration.
6

Create a Collection

A collection defines how Qdrant stores and searches vectors. One important setting is the vector size, which must match the output dimension of your embedding model.

</> Python
from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams

client = QdrantClient(url="http://localhost:6333")

client.create_collection(
    collection_name="documents",
    vectors_config=VectorParams(
        size=384,
        distance=Distance.COSINE,
    ),
)

print("Collection created")
Dimension matters:If your embedding model produces 768-dimensional vectors, the collection must be configured for 768 dimensions. A mismatch will cause insertion or query errors.
7

Insert Vectors with Payloads

Qdrant points can contain an ID, vector, and payload. Payloads let retrieval keep useful structured information close to the embedding.

</> Python
from qdrant_client.models import PointStruct

points = [
    PointStruct(
        id=1,
        vector=[0.10, 0.20, 0.30, 0.40],
        payload={
            "title": "Password Reset",
            "category": "support",
            "language": "en",
        },
    ),
    PointStruct(
        id=2,
        vector=[0.80, 0.10, 0.05, 0.20],
        payload={
            "title": "Shipping Policy",
            "category": "commerce",
            "language": "en",
        },
    ),
]

client.upsert(
    collection_name="documents",
    points=points,
)

print("Points inserted")
Production note: The vector dimension in this small example is intentionally tiny. Real embedding models usually produce hundreds or thousands of dimensions.
8

Search for Similar Vectors

A query vector can be compared against vectors in a collection. Qdrant returns the most relevant points according to the collection's configured distance metric.

</> Python
query_vector = [0.12, 0.18, 0.28, 0.42]

results = client.query_points(
    collection_name="documents",
    query=query_vector,
    limit=2,
).points

for result in results:
    print(result.id, result.score, result.payload)
What you get:A result can include the point ID, similarity score, and payload. Your application can then use the payload to retrieve or display the original content.
9

Metadata Filtering

Semantic similarity alone is often not enough. A search may need to find content that is both semantically relevant and allowed by an application rule.

Queryโ€œHow do I reset my password?โ€
+
Filtercategory = support
โ†’
QdrantSimilarity + filter
โ†’
ResultsRelevant support records
</> Python
from qdrant_client.models import FieldCondition, Filter, MatchValue

query_vector = [0.12, 0.18, 0.28, 0.42]

results = client.query_points(
    collection_name="documents",
    query=query_vector,
    query_filter=Filter(
        must=[
            FieldCondition(
                key="category",
                match=MatchValue(value="support"),
            )
        ]
    ),
    limit=3,
).points

for result in results:
    print(result.payload["title"], result.score)
10

Why Payloads Matter in RAG

1. ChunkSplit documents
โ†’
2. EmbedCreate vectors
โ†’
3. StoreVector + payload
โ†’
4. RetrieveSimilarity + filters
โ†’
5. GenerateLLM uses context

For example, a multi-tenant support assistant may need to retrieve semantically relevant chunks while ensuring that the chunks belong to the correct customer. Payload filters can participate in that retrieval design.

Security reminder:Do not assume a similarity search automatically enforces application authorization. Access-control rules must be designed, tested, and enforced correctly for your workload.
11

Qdrant in a Semantic Search Pipeline

DocumentsKnowledge base
โ†’
Embedding ModelText โ†’ vector
โ†’
QdrantStore + retrieve
โ†’
Top-k chunksRelevant context
โ†’
ApplicationSearch or RAG

The embedding model creates the vector representation. Qdrant handles storage and retrieval. The application decides what to do with the retrieved records.

12

Qdrant Local vs Managed Deployment

LOCAL

Development

Run Qdrant locally while learning, testing retrieval logic, or building a prototype.

SELF-HOSTED

Infrastructure control

Operate the service yourself when you need control over deployment and data infrastructure.

CLOUD

Managed operations

Use a managed deployment when reducing infrastructure work is more important than operating the service yourself.

Choose by requirements: latency, scale, reliability, security, operational ownership, cost, and data-location requirements matter more than simply choosing a popular tool.
13

Qdrant vs a Traditional SQL Database

SQL DATABASEExact structured queries

Excellent for transactions, relationships, aggregations, and exact predicates.

QDRANTSimilarity retrieval

Designed for nearest-neighbor search over embeddings, combined with payload-based retrieval constraints.

These systems are not necessarily competitors. A production application may use both: SQL for transactional business data and Qdrant for semantic retrieval.

14

Common Mistakes

1. Wrong vector dimension

The collection configuration must match the embedding model output.

2. Changing embedding models casually

Different models can produce incompatible dimensions or different vector spaces. Plan re-indexing when changing models.

3. Ignoring payload design

Store metadata that supports real retrieval requirements, but avoid turning payloads into an unstructured dumping ground.

4. Using similarity as authorization

Semantic relevance is not an access-control mechanism. Enforce permissions deliberately.

5. Retrieving too many chunks

More results do not automatically mean better RAG. Evaluate retrieval quality and context size.

6. Skipping evaluation

Measure recall, relevance, latency, and answer quality using representative queries.

15

When Should You Use Qdrant?

Semantic searchFind content by meaning rather than exact keyword overlap.
RAGRetrieve document chunks before an LLM generates an answer.
RecommendationsFind items whose vector representations are similar to a user's interest or query.
Filtered retrievalCombine vector similarity with structured metadata conditions.
Good fit:Qdrant becomes especially useful when you need persistent vector storage, payloads, filtering, and an operational retrieval service rather than only an in-process similarity index.
HANDS-ON PRACTICE

Build a Tiny Qdrant Semantic Search System

Create a small collection containing sentence embeddings and metadata.

  1. Run Qdrant locally or use an available Qdrant deployment.
  2. Create a collection whose vector size matches your embedding model.
  3. Insert at least five vectors with payloads such as title and category.
  4. Query the collection for the top three nearest vectors.
  5. Add a metadata filter and compare the results.
  6. Inspect the scores and decide whether the retrieved records are actually useful.
Challenge: Build a mini support-search system with categories such as billing, shipping, and account. Test the same semantic query with and without a category filter.

Quick Quiz

1. What is Qdrant?

A vector database designed for storing and retrieving vector representations with similarity search and structured payloads.

2. What is a collection?

A named group of points that share a vector configuration.

3. What is payload?

Structured metadata stored with a point, such as a title, category, source, or tenant.

4. Why use filters?

To constrain semantic retrieval using application-relevant metadata conditions.

30-Second Recap

EmbeddingsMeaning โ†’ vectors
โ†’
CollectionOrganize points
โ†’
QdrantStore + index
โ†’
SearchSimilarity + filters
โ†’
RAGUse context

Key Takeaways

  • Qdrant is a vector database designed for similarity search over embeddings.
  • A Qdrant collection stores points with vectors and optional payload metadata.
  • Payloads make it possible to combine semantic retrieval with structured filters.
  • The vector dimension and distance metric must match the design of your embedding pipeline.
  • Qdrant can serve as the retrieval layer for semantic search and RAG applications.
  • FAISS is primarily an in-process similarity-search library, while Qdrant provides database-oriented storage and retrieval capabilities.
  • Always evaluate retrieval quality, latency, scale, security, and operational requirements before choosing infrastructure.