OpenSearch is an Apache 2.0–licensed search and analytics suite, forked from Elasticsearch 7.10 and maintained by the OpenSearch Software Foundation (Linux Foundation). It offers full-text search, aggregations, log analytics, security plugins, alerting and vector search, with OpenSearch Dashboards as the web UI (the Kibana counterpart).
This guide runs a single node with Dashboards using Docker Compose — ideal for site search, a logging stack or evaluation.
Requirements
- 4 GB RAM or more (OpenSearch uses a JVM heap plus OS cache).
- Docker and Compose — see installing Docker.
- Kernel setting for memory-mapped files:
echo 'vm.max_map_count=262144' | sudo tee /etc/sysctl.d/99-opensearch.conf
sudo sysctl --system
1. Compose file
mkdir -p ~/opensearch && cd ~/opensearch
compose.yaml:
services:
opensearch:
image: opensearchproject/opensearch:2
container_name: opensearch
restart: unless-stopped
environment:
- cluster.name=search
- node.name=os-node1
- discovery.type=single-node
- bootstrap.memory_lock=true
- OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OS_ADMIN_PASSWORD}
ulimits:
memlock: { soft: -1, hard: -1 }
nofile: { soft: 65536, hard: 65536 }
volumes:
- os-data:/usr/share/opensearch/data
ports:
- "127.0.0.1:9200:9200"
dashboards:
image: opensearchproject/opensearch-dashboards:2
restart: unless-stopped
environment:
OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
ports:
- "127.0.0.1:5601:5601"
depends_on: [opensearch]
volumes:
os-data:
.env — the admin password must be strong (OpenSearch 2.12+ rejects weak ones):
echo "OS_ADMIN_PASSWORD='$(openssl rand -base64 18)Aa1!'" > .env
chmod 600 .env
docker compose up -d
docker compose logs -f opensearch
Pin a specific version tag in production. Heap: half of the memory you give OpenSearch at most, leaving the rest for the file cache.
2. Test
The security plugin is enabled with demo TLS certificates in the default image:
source .env
curl -sk -u "admin:$OS_ADMIN_PASSWORD" https://localhost:9200
curl -sk -u "admin:$OS_ADMIN_PASSWORD" "https://localhost:9200/_cluster/health?pretty"
Health shows yellow on a single node if indices have replicas; set number_of_replicas: 0 for single-node indices.
The demo certificates are fine for a private single node; for production clusters, replace them with your own certificates and review the security configuration.
3. Access Dashboards
Dashboards listens on localhost. Reach it with an SSH tunnel:
ssh -L 5601:127.0.0.1:5601 user@your-server
Open http://localhost:5601 and log in as admin. To publish it, put it behind Nginx with HTTPS and restrict access (IP allow-list or VPN) — see Nginx reverse proxy.
4. Index and search
OS="curl -sk -u admin:$OS_ADMIN_PASSWORD https://localhost:9200"
$OS -X PUT /articles -H 'Content-Type: application/json' -d '{"settings":{"number_of_replicas":0}}'
$OS -X POST /articles/_doc -H 'Content-Type: application/json' -d '{"title":"Install OpenSearch","body":"Search engine on a VPS"}'
$OS "/articles/_search?q=search&pretty"
Or use Dev Tools in Dashboards for an interactive console.
5. Users and roles
Create an internal user for your application with permissions limited to its indices (Dashboards → Security → Internal users / Roles). Don’t use admin in application configs.
6. Backups
Register a snapshot repository (filesystem path mounted into the container, or S3-compatible storage via the repository-s3 plugin) and schedule snapshots with Snapshot Management. See MinIO for self-hosted S3.
Use cases on a VPS
- Site and product search with relevance tuning.
- Log analytics: ship logs with Fluent Bit, Vector or Data Prepper; visualise in Dashboards — see log management.
- Vector search with the k-NN plugin for AI/RAG applications.
Lighter options
For simple website search, Meilisearch and Typesense use far less memory. Comparison: Elasticsearch vs Meilisearch. Elastic’s original product: installing Elasticsearch.