This is a complete, hands-on Vector Databases cheat sheet: install, configure, operate, automate and secure it - with copy-paste commands grouped by task. Bookmark it for day-to-day work, incidents and interviews alike.
Vector databases store high-dimensional embeddings and retrieve the nearest neighbours to a query vector, powering retrieval-augmented generation (RAG), semantic search and recommendations. Popular options include Pinecone, Weaviate and Qdrant.
Why you reach for it
- Fast approximate nearest-neighbour search at scale
- The retrieval layer that grounds LLMs in your data
- Metadata filtering for hybrid semantic + keyword search
Installation
# Run Qdrant locally
docker run -p 6333:6333 qdrant/qdrant
pip install qdrant-clientConfiguration reference
Create a collection and upsert embeddings.
from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams, PointStruct
c = QdrantClient('localhost', port=6333)
c.recreate_collection('docs', vectors_config=VectorParams(size=1536, distance=Distance.COSINE))
c.upsert('docs', [PointStruct(id=1, vector=emb, payload={'source': 'runbook'})])Core commands you use daily
hits = c.search('docs', query_vector=q_emb, limit=4,
query_filter={'must': [{'key': 'source', 'match': {'value': 'runbook'}}]})
for h in hits: print(h.score, h.payload)Qdrant via HTTP
curl -X PUT localhost:6333/collections/docs -H 'Content-Type: application/json' \
-d '{"vectors": {"size": 1536, "distance": "Cosine"}}'
curl -X POST localhost:6333/collections/docs/points/search -H 'Content-Type: application/json' \
-d '{"vector": [...], "limit": 4, "with_payload": true}'Python client
from qdrant_client import QdrantClient
c = QdrantClient('localhost', port=6333)
hits = c.search('docs', query_vector=q_emb, limit=4)
for h in hits: print(h.score, h.payload)Use it in CI/CD
Run the vector DB as a service for integration tests.
services:
qdrant:
image: qdrant/qdrant
ports: ['6333:6333']Best-practice checklist
- Keep the same embedding model for index and query
- Combine vector search with metadata filters (hybrid search)
- Version your embeddings and plan re-indexing
Common pitfalls to avoid
- Mismatched embedding model between indexing and querying
- Ignoring metadata filtering, so results lack precision
- No re-embedding strategy when the model changes
Security quick wins
- Isolate tenants by collection/namespace
- Authenticate access and encrypt data at rest
Works well with
- LangChain - A framework for building LLM apps and agents - chains, tools, retrieval and tracing with LangSmith.
- Redis - An in-memory data store used as a cache, session store, queue and rate limiter.
- Elasticsearch - A distributed search and analytics engine for logs, full-text search and (now) vectors.
A cheat sheet is muscle memory on paper - keep it close until the commands live in your fingers.
Want senior help putting Vector Databases to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.