How to Self-Host OpenSearch with Docker for Vector Search and Analytics
Complete step-by-step guide to self-hosting OpenSearch with Docker for AI vector search, RAG pipelines, and analytics.
Getting Started with OpenSearch
Self-hosting OpenSearch is straightforward thanks to its official Docker image. Below is a complete guide to getting your own OpenSearch cluster running in minutes for AI-powered search and vector storage.
Prerequisites
Ensure Docker and Docker Compose are installed on your machine. OpenSearch requires at least 2 GB of RAM for basic operation and 4 GB recommended for production use. For vector search workloads handling embeddings from LLMs, allocate at least 8 GB.
Quick Start with Docker
docker pull opensearchproject/opensearch:latest
docker run -d --name opensearch-node -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=YourSt...d1" opensearchproject/opensearch:latest
Once running, verify by curling the API:
curl -k -u admin:YourStrong@Password1 https://localhost:9200
Docker Compose for Production
For a more robust setup with OpenSearch Dashboards, use docker-compose:
services:
opensearch:
image: opensearchproject/opensearch:latest
restart: unless-stopped
ports:
- 9200:9200
volumes:
- ./data/opensearch:/data
environment:
- discovery.type=single-node
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=YourSt...
opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:latest
ports:
- 5601:5601
environment:
- OPENSEARCH_HOSTS=https://opensearch:9200
Vector Search Quick Start
Once OpenSearch is running, create an index with a vector field for your embeddings:
PUT /my-rag-index
{
"settings": { "index": { "knn": true } },
"mappings": {
"properties": {
"content": { "type": "text" },
"embedding": { "type": "knn_vector", "dimension": 768 }
}
}
}
Why Self-Host OpenSearch?
Running your own OpenSearch gives you full control over your data, no licensing costs, unlimited storage, and the ability to tune performance for your specific AI workloads. It integrates with every major RAG framework and supports hybrid search for the best retrieval quality.
Conclusion
OpenSearch is production-ready, feature-rich, and completely free. With Docker, you can have a vector search engine powering your AI applications in under 5 minutes. Visit the Run This Ai tool page for the full docker-compose setup.