Magento OpenSearch: admin settings, tests on port 9200, JVM heap
OpenSearch is the search engine behind Magento’s catalog search and layered navigation. In this short lesson: the Catalog Search settings in the admin, three checks on port 9200, the Java heap in jvm.options.d, the basics of opensearch.yml, and a reindex. Every command can be copied or downloaded.
Which OpenSearch for 2.4.9
Adobe’s system requirements (checked October 2026) list OpenSearch 3 for Magento Open Source / Adobe Commerce 2.4.9, on-premises and on cloud. Elasticsearch is not listed for 2.4.9 (2.4.8 on-premises still listed Elasticsearch 8; Elasticsearch 7.17 reached end of support on 15 January 2026). So on 2.4.9 the engine is OpenSearch. How we installed OpenSearch 3 on Ubuntu 24.04 is in Lesson 1 and in our installation guide.
Catalog Search in the admin
Stores › Configuration › Catalog › Catalog › Catalog Search, scope Default Config:
| Alan | Videodaki değer | Not |
|---|---|---|
| Search Engine | OpenSearch | the engine for 2.4.9 |
| OpenSearch Server Hostname | 127.0.0.1 | the same server; otherwise the search server’s private address |
| OpenSearch Server Port | 9200 | OpenSearch’s default HTTP port |
| OpenSearch Index Prefix | magento2 | every index starts with it; two shops on one OpenSearch need different prefixes |
| Enable OpenSearch HTTP Auth | Hayır | Yes + username and password when the security plugin is on. Keep them out of screenshots. |
| OpenSearch Server Timeout | 15 | seconds |
| Test Connection | Successful! | tests the values on screen, before you save |
Changed a value? Save Config, then reindex (below). The same with config:set:
#!/bin/bash
# MageBooster Lesson 13: the admin values of Catalog Search with config:set (Magento folder, as the file owner)
cd /var/www/magento
m() { sudo -u magento bin/magento config:set "$@"; }
m catalog/search/engine opensearch
m catalog/search/opensearch_server_hostname 127.0.0.1
m catalog/search/opensearch_server_port 9200
m catalog/search/opensearch_index_prefix magento2
m catalog/search/opensearch_enable_auth 0
m catalog/search/opensearch_server_timeout 15
# with the security plugin on (OpenSearch on another server): auth 1 + user/password, never typed into a shared terminal history
# m catalog/search/opensearch_enable_auth 1
# m catalog/search/opensearch_username magento
# m catalog/search/opensearch_password "$(cat /root/opensearch-pass.txt)"
sudo -u magento bin/magento indexer:reindex catalogsearch_fulltext
sudo -u magento bin/magento cache:flush
Test on port 9200
On the server, over SSH. Name, cluster name and version:
curl -s localhost:9200
Cluster health: green = every shard is assigned; yellow = all data is there but some replica copies have no second node (normal on a single server); red = data missing, check the log (/var/log/opensearch/).
curl -s 'localhost:9200/_cluster/health?pretty'
The indices: Magento creates one product index per store view (magento2_product_1_v…), with document count and size.
curl -s 'localhost:9200/_cat/indices?v&s=index'
JVM heap
OpenSearch runs on Java; the heap is the memory Java may use. Rules: -Xms = -Xmx (no resizing at runtime), about half the RAM on a server that only runs OpenSearch (the other half is the file system cache, which OpenSearch also uses), and never above about 31 GB (above that Java loses compressed object pointers). On a server shared with Magento, MariaDB, Valkey and Varnish, give it less: our 10 GB test server gets 3 GB.
grep -n '^-Xm' /etc/opensearch/jvm.options; ls /etc/opensearch/jvm.options.d/; free -h
Don’t edit jvm.options: a package update can replace it. Files in /etc/opensearch/jvm.options.d/ are read after it, so their values win:
# OpenSearch heap: min = max. About half the RAM on a dedicated search server, never above ~31g. -Xms3g -Xmx3g
Save as /etc/opensearch/jvm.options.d/heap.options, or create it with the command below.
cat > /etc/opensearch/jvm.options.d/heap.options <<'EOF' # OpenSearch heap: min = max. About half the RAM on a dedicated search server, never above ~31g. -Xms3g -Xmx3g EOF
Restart, wait until it answers, and check the running node:
systemctl restart opensearch until curl -s localhost:9200 >/dev/null; do sleep 2; done
curl -s 'localhost:9200/_cat/nodes?v&h=name,heap.max,ram.max'
opensearch.yml
grep -E '^(network\.host|discovery\.type|plugins\.security\.disabled)' /etc/opensearch/opensearch.yml
| Line | Neden |
|---|---|
network.host: 127.0.0.1 | OpenSearch listens on this server only |
discovery.type: single-node | one node, no cluster to look for |
plugins.security.disabled: true | no HTTPS and no login: only acceptable because nobody else can reach port 9200 |
# /etc/opensearch/opensearch.yml: the lines added in Lesson 1 (OpenSearch on the same server as Magento) network.host: 127.0.0.1 discovery.type: single-node plugins.security.disabled: true
ss -ltn | grep 9200
Expect 127.0.0.1:9200 only. Never open port 9200 to the internet. OpenSearch on its own server: keep the security plugin on, use HTTPS, allow only the web server in the firewall, and set HTTP Auth in the admin.
Reindex
After changing the search settings, or when search results look wrong, rebuild the catalog search index as the Magento file owner (in our lessons the user magento), in the Magento folder:
bin/magento indexer:reindex catalogsearch_fulltext
bin/magento indexer:status catalogsearch_fulltext
curl -s 'localhost:9200/_cat/indices?v&s=index'
İndirmeler
#!/bin/bash # MageBooster Lesson 13: OpenSearch for Magento 2.4.9. Run the parts one by one on the server (as root, unless noted). # 1) Test on port 9200 (on the OpenSearch server itself) curl -s localhost:9200 curl -s 'localhost:9200/_cluster/health?pretty' curl -s 'localhost:9200/_cat/indices?v&s=index' # 2) JVM heap: what is set now, and the RAM of the server grep -n '^-Xm' /etc/opensearch/jvm.options; ls /etc/opensearch/jvm.options.d/; free -h # your own heap file (min = max; ~half the RAM on a search-only server, never above ~31g). Change 3g to your value. cat > /etc/opensearch/jvm.options.d/heap.options <<'EOF' # OpenSearch heap: min = max. About half the RAM on a dedicated search server, never above ~31g. -Xms3g -Xmx3g EOF systemctl restart opensearch until curl -s localhost:9200 >/dev/null; do sleep 2; done curl -s 'localhost:9200/_cat/nodes?v&h=name,heap.max,ram.max' # 3) opensearch.yml without comments, and who listens on 9200 (should be 127.0.0.1 only) grep -E '^(network\.host|discovery\.type|plugins\.security\.disabled)' /etc/opensearch/opensearch.yml ss -ltn | grep 9200 # 4) Reindex catalog search, as the Magento file owner, in the Magento folder cd /var/www/magento sudo -u magento bin/magento indexer:reindex catalogsearch_fulltext sudo -u magento bin/magento indexer:status catalogsearch_fulltext curl -s 'localhost:9200/_cat/indices?v&s=index'
Sorun giderme
| Belirti | Neden ve çözüm |
|---|---|
| Test Connection: Connection failed | OpenSearch not running (systemctl status opensearch), wrong host/port, or HTTPS/auth on (OpenSearch 3 package defaults to the security plugin with HTTPS). |
curl localhost:9200: empty reply / connection reset | The security plugin is on: OpenSearch answers on https only. Disable it for a localhost-only setup (opensearch.yml) or use https:// with credentials. |
| OpenSearch does not start after the heap change | journalctl -u opensearch -n 50: heap larger than free RAM, or a typo in heap.options (one option per line). |
| Status red | A primary shard is missing: check /var/log/opensearch/ and disk space (OpenSearch stops writing above the disk watermark). |
| Search shows old products | bin/magento indexer:reindex catalogsearch_fulltext, and check cron (indexers on schedule). |
Sonraki ders
Lesson 14: Redis / Valkey, for the cache, the full page cache and sessions.
▶ Tüm MageBooster derslerini YouTube’da izleyin: sırayla tüm dersler · kanala abone olun
