OpenSearch is an open-source search and analytics engine. You store documents in JSON format, such as products, articles, or log lines, and retrieve them in milliseconds with full-text search, including typo tolerance, filters, and relevance-based sorting. OpenSearch was created in 2021 as a fork of Elasticsearch 7.10, is licensed under Apache 2.0, and is now developed by the OpenSearch Software Foundation. OpenSearch is accessed through a REST API on port 9200; OpenSearch Dashboards is available as a separate graphical interface. In this guide, we'll show you two ways to get started: the simple way, using a One-Click App that provides HTTPS access to the REST API with login, and a manual installation with Docker Compose that includes OpenSearch Dashboards. Then you'll create an index, store documents, search them, and set up a dedicated user for your application.
OpenSearch is worth using as soon as a regular database search with LIKE is no longer enough. OpenSearch is a good fit on a VPS if:
- Your website or store needs fast full-text search that accounts for word forms, typos, and relevance, and filters results by category or price.
- Your software requires OpenSearch or Elasticsearch as a search backend, such as store systems, wikis, or ticketing systems with an Elasticsearch-compatible interface.
- You want to search logs and events, for example logs from multiple servers that you collect with Fluent Bit, Logstash, or Data Prepper.
- You want to test and develop search functionality with your own instance instead of an expensive cloud service.
- You want to try vector search for AI applications. OpenSearch includes the k-NN plugin for semantic search.
OpenSearch is less suitable if your VPS has limited RAM. OpenSearch runs on Java and uses around 1 GB of RAM even when idle. For a simple search across a few thousand entries, lighter search servers such as Meilisearch are enough, and for large volumes of logs spanning several months, you'll need multiple servers instead of a single VPS.
Both programs have the same roots and a very similar REST API. Many queries work unchanged in both, but since the 2021 fork, they have been developed separately.
| OpenSearch | Elasticsearch | |
|---|---|---|
| License | Apache 2.0 | Elastic License, SSPL, or AGPL |
| Interface | OpenSearch Dashboards | Kibana |
| Users and permissions | Security plugin included in the image | Also included in current versions |
| Clients | Dedicated clients for Python, Java, JavaScript, and more | Dedicated clients; newer versions check the server type |
Choose OpenSearch if you want a fully open-source license or your software explicitly supports OpenSearch. If your software requires a specific version of Elasticsearch, stick with Elasticsearch, because the official Elasticsearch clients don't always connect to OpenSearch.
The fastest way to get OpenSearch running is through the One-Click Apps on your VPS. The REST API is directly accessible over HTTPS using a domain, and a password for the admin account is generated automatically. You don't need a reverse proxy or a certificate.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps to learn how.
- At least 2 GB of free RAM. The One-Click App gives OpenSearch a fixed Java heap of 512 MB, but the container still uses around 1 GB of RAM right after startup.
- Around 2 GB of disk space for the image, plus space for your data.
- Open your VPS in the ZapX Dashboard and switch to the One-Click Apps tab.
- Search the app catalog for OpenSearch and click Install on its card.
- Use a custom subdomain or zap.cloud is already selected, with a randomly generated name. Leave the option enabled or enter a custom name, such as
search. You can use this domain to access the REST API over HTTPS. - You don't need to enter anything under App configuration. The
SERVICE_PASSWORD_OPENSEARCHpassword is generated automatically during installation. - Click Queue installation.
Installation takes two to three minutes because the image is downloaded the first time. Afterward, the app's status will be Online.
The One-Click App does not include a web interface for OpenSearch. You access the REST API directly, for example with curl or from your application. The username is admin; you can find the password in the dashboard:
- Click the gear icon on the app card and switch to App environment.
- Under Automatically generated values, you'll find
SERVICE_PASSWORD_OPENSEARCH. Click the eye icon to reveal the value or the adjacent icon to copy it. - Open the Access link in your browser. You'll be prompted for a username and password, then see the version and cluster name as JSON.
To check your access from the command line, run the following. Replace search.example.com with your app's domain and PASSWORD with the password:
curl -u admin:PASSWORD https://search.example.com/
curl -u admin:PASSWORD https://search.example.com/_cluster/health
Without credentials, OpenSearch responds with 401 Unauthorized. The container's ports 9200, 9300, and 9600 are not directly accessible through your VPS's IP address; only the domain is accessible.
The official OpenSearch image sets up a demo configuration for the Security plugin on first startup. Alongside admin, it creates demo users whose passwords match their usernames, such as readall with the password readall. The One-Click App automatically deletes these users: once OpenSearch is running, a small helper service removes readall, anomalyadmin, logstash, snapshotrestore, and kibanaro. This happens again every time the app starts, and a user that has already been deleted stays deleted. You don't need to do anything.
If you want to check for yourself, list the existing users:
curl -u admin:PASSWORD "https://search.example.com/_plugins/_security/api/internalusers?pretty"
The remaining users will be admin and kibanaserver. kibanaserver is a protected system user for OpenSearch Dashboards that cannot be deleted through the API. It is not allowed to search your indices.
Update OpenSearch in the app settings (gear icon) under App update. Click Check for updates, then install a new version with Apply update. If the app is up to date, no newer version is available in the app catalog yet. The One-Click App uses the official opensearchproject/opensearch image with a fixed version, which is OpenSearch 3.10 at the time of writing.
Indices, documents, and users are stored in the app's /usr/share/opensearch/data directory and are retained across updates and restarts. Snapshots to a directory on the server are not configured in the One-Click App because the path.repo setting is missing. So, before an update, use your VPS Backups in the dashboard. You can set up snapshots in a custom directory with the manual installation, as described below.
The rest of this guide describes the manual installation of OpenSearch with Docker Compose on your VPS. This is useful, for example, if you don't use One-Click Apps on your server, need OpenSearch Dashboards, want to set a larger Java heap, or want to save snapshots to a custom directory.
- A Linux VPS running Debian or Ubuntu, with SSH access. See First SSH Access.
- Docker and Docker Compose (Compose v2). See Install Docker. Check the installation with
docker --versionanddocker compose version. - A domain or subdomain whose A record points to your VPS's IP address (for example,
dashboards.example.com) if you want to access OpenSearch Dashboards over HTTPS.
OpenSearch needs RAM above all. As a rule of thumb, allocate half of the RAM you give OpenSearch to the Java heap. The operating system uses the rest to cache the index files:
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU cores | 4 vCPU cores |
| RAM | 4 GB | 8 GB |
| Storage | 20 GB | 50 GB SSD |
With a 1 GB heap, as in the example below, OpenSearch and Dashboards use around 1.8 GB of RAM combined.
OpenSearch maps its index files into memory and needs more memory regions than Linux allows by default (65530). The official documentation requires a value of 262144. In single-node mode with discovery.type=single-node, OpenSearch will start even without this setting, but memory can become scarce when you have many indices. So, set the value permanently:
echo "vm.max_map_count=262144" > /etc/sysctl.d/99-opensearch.conf
sysctl --system
sysctl vm.max_map_count
The last line should output vm.max_map_count = 262144. On a VPS, you can change this kernel setting yourself, and it will also apply after a restart.
OpenSearch uses port 9200 for the REST API, and OpenSearch Dashboards uses port 5601. Bind both to 127.0.0.1. Only the reverse proxy will be accessible from outside, so use ufw to allow only SSH and ports 80 and 443:
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Ports published by Docker with ports: are accessible from outside even if ufw blocks them. Docker adds its own rules ahead of the ufw rules. So, keep the 127.0.0.1: prefix before the ports in the Compose file. For more information, see Open Ports and Manage the Firewall on Linux.
Create a directory for OpenSearch, along with a folder for snapshots owned by the container's user (UID 1000). The admin password must be strong: use uppercase and lowercase letters, digits, and special characters. This command writes a suitable password directly to the .env file without displaying it:
mkdir -p /opt/opensearch/snapshots
cd /opt/opensearch
chown 1000:1000 snapshots
echo "OPENSEARCH_INITIAL_ADMIN_PASSWORD=Os-$(openssl rand -hex 16)-A1" > .env
chmod 600 .env
Next, create a docker-compose.yml file, for example with nano docker-compose.yml, and add the following content:
services:
opensearch:
image: opensearchproject/opensearch:3
container_name: opensearch
restart: unless-stopped
environment:
- cluster.name=opensearch
- node.name=opensearch-node1
- discovery.type=single-node
- bootstrap.memory_lock=true
- OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
- plugins.security.ssl.http.enabled=false
- path.repo=/usr/share/opensearch/snapshots
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data:/usr/share/opensearch/data
- ./snapshots:/usr/share/opensearch/snapshots
ports:
- "127.0.0.1:9200:9200"
dashboards:
image: opensearchproject/opensearch-dashboards:3
container_name: opensearch-dashboards
restart: unless-stopped
environment:
- 'OPENSEARCH_HOSTS=["http://opensearch:9200"]'
ports:
- "127.0.0.1:5601:5601"
depends_on:
- opensearch
volumes:
opensearch-data:
Here's what the important lines mean:
opensearchproject/opensearch:3: The official image. The3tag stands for the latest version of OpenSearch 3. Dashboards uses the same tag because the two versions must match.discovery.type=single-node: OpenSearch runs as a single node and does not look for other servers.bootstrap.memory_lock=trueandmemlock: OpenSearch locks its heap in RAM to prevent it from being moved to swap.OPENSEARCH_JAVA_OPTS: Sets the Java heap.-Xmsand-Xmxshould be the same and should not exceed half of the RAM.OPENSEARCH_INITIAL_ADMIN_PASSWORD: Sets the password foradminon first startup. OpenSearch 3 will not start without this value.plugins.security.ssl.http.enabled=false: The REST API uses unencrypted HTTP on127.0.0.1:9200. The reverse proxy handles HTTPS. OpenSearch still checks the username and password.path.repo: Allows snapshots to be saved in the/opt/opensearch/snapshotsdirectory.
Pull the images and start both containers:
docker compose pull
docker compose up -d
docker compose logs -f opensearch
OpenSearch should respond after one to two minutes. Exit the log view with Strg+C.
The image also creates demo users on manual installations, with passwords that match their usernames, such as readall with the password readall. readall and anomalyadmin can read all your indices. Unlike the One-Click App, no one deletes them for you here. Remove them before storing data or making OpenSearch accessible through a reverse proxy.
Delete the demo users with this command:
P=$(grep OPENSEARCH_INITIAL_ADMIN_PASSWORD .env | cut -d= -f2-)
for u in readall anomalyadmin logstash snapshotrestore kibanaro; do
curl -u "admin:$P" -X DELETE "http://127.0.0.1:9200/_plugins/_security/api/internalusers/$u"
done
Each response line should contain deleted. Check which users still exist with curl -u "admin:$P" "http://127.0.0.1:9200/_plugins/_security/api/internalusers?pretty". The remaining users will be admin and the protected system user kibanaserver, which OpenSearch Dashboards needs. The deleted users will stay deleted after restarts and updates because users are stored in the data directory.
Check that OpenSearch is running on the server:
curl -u "admin:$P" http://127.0.0.1:9200/_cluster/health?pretty
The status value should be green. To access OpenSearch Dashboards without a reverse proxy, use an SSH tunnel: run ssh -L 5601:127.0.0.1:5601 root@SERVER_IP on your own computer, then open http://localhost:5601 in your browser. Log in with the admin user and the password from the .env file. You can view it on the server with grep OPENSEARCH_INITIAL_ADMIN_PASSWORD /opt/opensearch/.env.
For ongoing access to OpenSearch Dashboards, put a reverse proxy with a valid certificate in front of it. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). Here's a server block for nginx:
server {
listen 80;
server_name dashboards.example.com;
location / {
proxy_pass http://127.0.0.1:5601;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Then get the certificate with certbot --nginx -d dashboards.example.com. Certbot adds HTTPS and HTTP redirection to the block. If programs on other servers need the REST API, create a second server block for 127.0.0.1:9200 with its own subdomain. Never expose the REST API to the internet without HTTPS, or the username and password will be sent over the network unencrypted. For more tips, see Linux Security Tips.
OpenSearch creates snapshots of indices while it is running. Register the /opt/opensearch/snapshots directory once as a repository named backup:
curl -u "admin:$P" -X PUT "http://127.0.0.1:9200/_snapshot/backup" -H "Content-Type: application/json" -d '{"type":"fs","settings":{"location":"/usr/share/opensearch/snapshots"}}'
Then use one command to create a snapshot with today's date and another to list all snapshots:
curl -u "admin:$P" -X PUT "http://127.0.0.1:9200/_snapshot/backup/snapshot-$(date +%F)?wait_for_completion=true"
curl -u "admin:$P" "http://127.0.0.1:9200/_cat/snapshots/backup?v"
Snapshots are incremental, so each new one stores only the changes. Regularly copy the /opt/opensearch/snapshots folder to another server and also back up the .env and docker-compose.yml files. Restore an index with POST /_snapshot/backup/<snapshot>/_restore. Before restoring, you must delete or close the existing index with the same name. For details, see the official documentation on Snapshots.
With the 3 tag, docker compose pull gets the latest version of OpenSearch 3 and OpenSearch Dashboards 3 each time. Create a snapshot before updating:
cd /opt/opensearch
curl -u "admin:$P" -X PUT "http://127.0.0.1:9200/_snapshot/backup/before-update-$(date +%F)?wait_for_completion=true"
docker compose pull
docker compose up -d
A single-node instance will be unavailable for one to two minutes while it restarts. Before making a major version jump, read the Release Notes. To switch to a new major version, such as OpenSearch 4, you must first change the tag in docker-compose.yml yourself. The installed version is shown under number by curl -u "admin:$P" http://127.0.0.1:9200/.
The following steps apply to both the One-Click App and the manual installation. Replace https://search.example.com with your One-Click App's domain, or with http://127.0.0.1:9200 for the manual installation. Replace PASSWORD with the admin password.
An index is similar to a table. In the mapping, you define the fields and how OpenSearch handles them. text is split into words for full-text search, while keyword is kept as a whole and is suitable for filtering and sorting:
curl -u admin:PASSWORD -X PUT "https://search.example.com/products" -H "Content-Type: application/json" -d '{
"settings": { "number_of_shards": 1, "number_of_replicas": 0 },
"mappings": {
"properties": {
"name": { "type": "text" },
"category": { "type": "keyword" },
"price": { "type": "float" },
"created": { "type": "date" }
}
}
}'
number_of_replicas is set to 0 because there is no second node on a single server to hold copies. With the default value of 1, the cluster status will remain yellow. View an index's mapping with GET /products/_mapping. You can't change the type of an existing field later. Instead, create a new index and copy the data over with _reindex.
Store a single document with POST /products/_doc. refresh=true makes it searchable immediately:
curl -u admin:PASSWORD -X POST "https://search.example.com/products/_doc?refresh=true" -H "Content-Type: application/json" -d '{"name":"Gaming Headset Pro","category":"audio","price":79.90,"created":"2026-11-30"}'
To upload many documents at once, use the Bulk API. Create a products.ndjson file with one line for the action followed by one line for the document, repeating this pattern. The file must end with a blank line:
{"index":{"_index":"products"}}
{"name":"Wireless Gaming Mouse","category":"input","price":49.90,"created":"2026-11-29"}
{"index":{"_index":"products"}}
{"name":"Mechanical Keyboard","category":"input","price":119.00,"created":"2026-11-28"}
curl -u admin:PASSWORD -X POST "https://search.example.com/_bulk?refresh=true" -H "Content-Type: application/x-ndjson" --data-binary @products.ndjson
A full-text search for the word “gaming” finds both gaming products, regardless of capitalization:
curl -u admin:PASSWORD "https://search.example.com/products/_search?pretty" -H "Content-Type: application/json" -d '{"query":{"match":{"name":"gaming"}}}'
Combine full-text search and filters with a bool query. This query searches for “gaming,” but only in the input category and at a price of 60 or less:
curl -u admin:PASSWORD "https://search.example.com/products/_search?pretty" -H "Content-Type: application/json" -d '{
"query": {
"bool": {
"must": { "match": { "name": "gaming" } },
"filter": [
{ "term": { "category": "input" } },
{ "range": { "price": { "lte": 60 } } }
]
}
}
}'
The result now contains only the “Wireless Gaming Mouse.” Filters don't affect relevance and are cached, so put fixed conditions in filter, not must.
Your application should not use admin. Create a role that can only read and write to indices named products and products-*, a shop user, and a mapping between them. The password must be strong and should not resemble the username. openssl rand -base64 24 generates a suitable one:
curl -u admin:PASSWORD -X PUT "https://search.example.com/_plugins/_security/api/roles/products_rw" -H "Content-Type: application/json" -d '{"cluster_permissions":["cluster_composite_ops"],"index_permissions":[{"index_patterns":["products*"],"allowed_actions":["crud","create_index"]}]}'
curl -u admin:PASSWORD -X PUT "https://search.example.com/_plugins/_security/api/internalusers/shop" -H "Content-Type: application/json" -d '{"password":"SHOP_PASSWORD"}'
curl -u admin:PASSWORD -X PUT "https://search.example.com/_plugins/_security/api/rolesmapping/products_rw" -H "Content-Type: application/json" -d '{"users":["shop"]}'
The shop user can then search products, store documents, and use the Bulk API. Other indices and user management will remain inaccessible to them (403). In your application, enter your app's URL, the shop username, and its password. For Python, for example, there's the official opensearch-py client.
OpenSearch Dashboards is the web interface for OpenSearch and is included in the manual installation above. The One-Click App does not include Dashboards. After logging in, you'll find the following options in the left-hand menu:
- Dev Tools: A console where you can enter queries such as
GET products/_searchdirectly, withoutcurlor a password in every line. - Discover: Search and filter documents in a table. First, create a pattern such as
products*under Dashboards Management > Index patterns. - Visualize and Dashboards: Charts and dashboards, for example, to display log data over time.
- Security: Manage users, roles, and mappings with a few clicks instead of using the API.
Dashboards logs in to OpenSearch internally with the kibanaserver system user. So, don't delete or modify this user.
- Single node: If the VPS goes down, search is unavailable. Replicas and fault tolerance require at least three servers in a dedicated cluster.
- RAM: OpenSearch uses around 1 GB of RAM even without data. If the heap is too small, queries will slow down or fail with
circuit_breaking_exception. The One-Click App's heap is fixed at 512 MB. For larger amounts of data, use the manual installation and allocate more heap. - Disk space: When disk usage reaches 85%, OpenSearch stops allocating new shards. At 95%, it sets indices to read-only. Keep an eye on free space.
- Don't use it as your only data source: Keep the original data in your application or database and populate OpenSearch from there. That way, you can rebuild an index at any time.
- No snapshots in the One-Click App: Without
path.repo, you can't save snapshots to a directory there. Use your VPS Backups instead.
You've set up OpenSearch on your VPS, logged in with the admin account, created an index with a mapping, stored documents, and searched them with full-text search and filters. With a dedicated user for your application, your website or store can now use fast search.
Prefer not to deal with Docker manually? Use the simple One-Click App method described above in “The Simple Way: OpenSearch as a One-Click App.”
