Vector Databases and Elasticsearch are a common pairing in a modern DevOps stack. Here is how they fit together and a practical way to wire them up.
Where Vector Databases fits
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.
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'})])Where Elasticsearch fits
Elasticsearch is a distributed search and analytics engine built on Lucene, widely used for log analytics (the ELK/Elastic stack), full-text search and, increasingly, vector search.
curl -X PUT localhost:9200/logs -H 'Content-Type: application/json' -d '{
"mappings": { "properties": {
"@timestamp": { "type": "date" },
"level": { "type": "keyword" },
"message": { "type": "text" }
} }
}'Making them work together
- Keep the same embedding model for index and query
- Combine vector search with metadata filters (hybrid search)
- Define explicit mappings; disable dynamic where possible
- Use Index Lifecycle Management for retention/rollover
Want this pairing set up properly, with docs and handover? That is exactly the kind of work CodeWizard's embedded senior engineers do - and both Vector Databases and Elasticsearch have active community groups you can join for free.