Practical: Qdrant for Local Vector Search

Harry · 13 Sep 2026 · 2 views

What Is Qdrant

Qdrant is an open-source vector engine with a Python client, REST and gRPC APIs. It runs as a server, but an embedded mode lets you start from a Python process with zero infrastructure.

Install and Create a Collection

pip install qdrant-client

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

client = QdrantClient(path="qdrant_store")   # embedded, file-based
client.create_collection(
    collection_name="products",
    vectors_config=VectorParams(size=384, distance=Distance.COSINE),
)

Upsert Points

client.upsert(
    collection_name="products",
    points=[
        {"id": 1, "vector": [0.1, 0.2, 0.3, 0.1], "payload": {"name": "wireless mouse", "price": 599}},
        {"id": 2, "vector": [0.3, 0.1, 0.2, 0.1], "payload": {"name": "mechanical keyboard", "price": 1499}},
    ],
)

Search with Payload Filter

from qdrant_client.models import Filter, FieldCondition, MatchValue

hits = client.search(
    collection_name="products",
    query_vector=[0.1, 0.2, 0.3, 0.1],
    query_filter=Filter(must=[
        FieldCondition(key="price", match=MatchValue(value=599)),
    ]),
    limit=3,
)
for hit in hits:
    print(hit.payload["name"], round(hit.score, 3))

Server Mode

For production, run the Qdrant server via Docker and connect with QdrantClient(host="localhost", port=6333). Collections scale across shards automatically.

Key Points

  • Embedded mode starts a local store from Python.
  • Points carry arbitrary payload metadata.
  • Filters combine with vector search in one query.
  • Docker server mode is the production path.
Share this post:

Comments (0)

Please login or register to comment.