Course contentsShow
← AI Engineering
Lesson 310 of 1,8868. Vector Databases - ToolsFree lesson

Qdrant: Installation and Collections

Setting up Qdrant locally, creating collections with distance metrics, and understanding payload indexing strategies.

Qdrant: Installation and Collections

What you'll learn: How to install Qdrant locally, create your first collections with distance metrics, and configure payload indexing for efficient metadata filtering.

Getting Qdrant Running

Qdrant is an open-source vector database you can run locally or deploy to production. The easiest way to get started is with Docker:

docker pull qdrant/qdrant
docker run -p 6333:6333 qdrant/qdrant

This starts Qdrant with a REST API on port 6333 and a web UI at http://localhost:6333/dashboard. You can also install it via Python:

pip install qdrant-client

Creating Collections

A collection in Qdrant is like a table—it holds vectors of the same dimensionality. When creating a collection, you must specify the vector size and distance metric:

from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams

client = QdrantClient("localhost", port=6333)

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

Distance metrics determine how similarity is calculated: COSINE for normalized embeddings, EUCLID for spatial distance, or DOT for raw dot product scores.

Payload Indexing

Qdrant stores metadata as payloads alongside vectors. By default, payloads aren't indexed. To enable fast filtering on specific fields:

from qdrant_client.models import PayloadSchemaType

client.create_payload_index(
    collection_name="my_documents",
    field_name="category",
    field_schema=PayloadSchemaType.KEYWORD
)

This creates an index on the category field, making filtered searches much faster—essential when combining vector similarity with metadata conditions.

Key Takeaway: Qdrant requires Docker or pip installation, collections need vector dimension and distance metric configuration, and payload indexing dramatically speeds up metadata filtering in hybrid searches.