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.
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.
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.
A numerical representation of text, images, or other content.
Stores vectors and payloads and finds relevant points.
Uses the returned records for search, recommendations, or RAG.
Qdrant vs FAISS
FAISS and Qdrant can both help you perform vector similarity search, but they solve different layers of the problem.
Similarity-search library
Great for local experiments, research, and applications that manage their own persistence and metadata mapping.
Vector database
Provides collections, persistent records, payloads, filtering, and database-style access around vector retrieval.
Core Qdrant Concepts
How a Qdrant Collection Looks
[0.12, -0.41, 0.78, ...]
title, category, language, source
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.
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.
from qdrant_client import QdrantClient
client = QdrantClient(
url="http://localhost:6333"
)
print(client.get_collections())
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.
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")
Insert Vectors with Payloads
Qdrant points can contain an ID, vector, and payload. Payloads let retrieval keep useful structured information close to the embedding.
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")
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.
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)
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.
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)
Why Payloads Matter in RAG
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.
Qdrant in a Semantic Search Pipeline
The embedding model creates the vector representation. Qdrant handles storage and retrieval. The application decides what to do with the retrieved records.
Qdrant Local vs Managed Deployment
Development
Run Qdrant locally while learning, testing retrieval logic, or building a prototype.
Infrastructure control
Operate the service yourself when you need control over deployment and data infrastructure.
Managed operations
Use a managed deployment when reducing infrastructure work is more important than operating the service yourself.
Qdrant vs a Traditional SQL Database
Excellent for transactions, relationships, aggregations, and exact predicates.
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.
Common Mistakes
The collection configuration must match the embedding model output.
Different models can produce incompatible dimensions or different vector spaces. Plan re-indexing when changing models.
Store metadata that supports real retrieval requirements, but avoid turning payloads into an unstructured dumping ground.
Semantic relevance is not an access-control mechanism. Enforce permissions deliberately.
More results do not automatically mean better RAG. Evaluate retrieval quality and context size.
Measure recall, relevance, latency, and answer quality using representative queries.
When Should You Use Qdrant?
Build a Tiny Qdrant Semantic Search System
Create a small collection containing sentence embeddings and metadata.
- Run Qdrant locally or use an available Qdrant deployment.
- Create a collection whose vector size matches your embedding model.
- Insert at least five vectors with payloads such as
titleandcategory. - Query the collection for the top three nearest vectors.
- Add a metadata filter and compare the results.
- Inspect the scores and decide whether the retrieved records are actually useful.
billing, shipping, and account. Test the same semantic query with and without a category filter.Quick Quiz
A vector database designed for storing and retrieving vector representations with similarity search and structured payloads.
A named group of points that share a vector configuration.
Structured metadata stored with a point, such as a title, category, source, or tenant.
To constrain semantic retrieval using application-relevant metadata conditions.
30-Second Recap
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.