How to Set Up a Weaviate Vector Database in 10 Minutes
Weaviate is an open-source vector database that stores embeddings and lets you search by meaning rather than exact keywords. It also handles hybrid search, which blends vector similarity with BM25 keyword matching.
Quick answer: Run docker compose up with the Weaviate image, connect from Python with the v4 client, create a collection, and insert vectors. No API key needed locally.
Why Weaviate over a plain file of embeddings? The moment you pass a few thousand vectors, brute-force cosine similarity gets slow and you want an index, filtering, and persistence. That is the whole point of a vector database.
How do you run Weaviate locally?
Docker is the fastest path. Save this and run it:
# docker-compose.yml
services:
weaviate:
image: cr.weaviate.io/semitechnologies/weaviate:1.28.0
ports:
- "8080:8080"
- "50051:50051"
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true"
PERSISTENCE_DATA_PATH: "/var/lib/weaviate"
DEFAULT_VECTORIZER_MODULE: "none"
volumes:
- ./data:/var/lib/weaviate
docker compose up -d
Setting the vectorizer to none means you supply your own vectors. That keeps the setup provider-agnostic and avoids Weaviate calling an embedding API for you.
How do you connect with the Python client?
pip install weaviate-client
import weaviate
client = weaviate.connect_to_local()
print(client.is_ready())
Version 4 of the client changed a lot from v3, so check the docs match your installed version. Most old tutorials online are still v3 and will fail outright.
How do you create a collection and insert data?
from weaviate.classes.config import Property, DataType
col = client.collections.create(
"Document",
properties=[
Property(name="text", data_type=DataType.TEXT),
Property(name="source", data_type=DataType.TEXT),
],
)
col.data.insert(properties={"text": "LangChain connects LLMs to tools",
"source": "guide"},
vector=[0.12, 0.98, 0.44, 0.07])
Use a real embedding model for the vector. The numbers above are placeholders to show the shape — a real 1536-dimension vector comes from your embedding provider.
How do you run a search?
Semantic search takes a query vector and returns the nearest items. Hybrid search adds a keyword component, which rescues names and codes that embeddings often miss.
res = col.query.near_vector(near_vector=query_vec, limit=5)
for o in res.objects:
print(o.properties["text"])
Are there real costs?
The open-source Weaviate is free to self-host; you pay for the server it runs on. Weaviate Cloud starts with a free sandbox tier and scales to paid clusters priced by resources. The embeddings themselves usually cost more than the database on small projects.
What should you watch out for?
- Dimension mismatch: insert a vector of the wrong length and it is rejected.
- Client version churn: v3 examples silently fail on v4.
- Anonymous access is for local use only — never expose that port to the internet.
- Deleting a collection drops everything; there is no undo.
Who this suits: teams building semantic or hybrid search who want an open-source option they can host. Who should skip it: if you have under a few thousand vectors and no concurrency, a numpy array is simpler and needs no infrastructure.
Quick Summary
- Weaviate is an open-source vector database with hybrid search built in.
- Run it locally with Docker; no API key required.
- Use the v4 Python client and create collections before inserting.
- Self-hosted is free; embeddings are the real recurring cost.
- Overkill below a few thousand vectors — start simple.
