Magento 2 relies on a search engine for catalog search and, on most setups, for layered navigation on category pages. Recent Magento 2.4 versions use OpenSearch (older versions use Elasticsearch). When the search engine has a problem, symptoms range from empty search results to category pages without products and failed reindexes.
This guide covers the most common errors and how to fix them.
First checks
Is the search engine running and healthy?
curl -s http://localhost:9200
curl -s http://localhost:9200/_cluster/health?pretty
curl -s http://localhost:9200/_cat/indices?v
- green: all good
- yellow: replicas not assigned. Normal on a single-node setup if indices have replicas
- red: primary data missing, needs attention
Which engine and host does Magento use?
bin/magento config:show catalog/search/engine
bin/magento config:show catalog/search/opensearch_server_hostname
bin/magento config:show catalog/search/opensearch_server_port
(For Elasticsearch, the paths use elasticsearch7_ instead of opensearch_.)
Error: “Could not validate a connection” / “No alive nodes found in your cluster”
Magento cannot reach the search engine.
Causes and fixes:
- Service stopped:
sudo systemctl status opensearchand check its logs. Often it was killed for lack of memory - Wrong host or port in Magento configuration: fix with
bin/magento config:set catalog/search/opensearch_server_hostname localhost - Authentication enabled in OpenSearch (security plugin) but not configured in Magento: set the username and password in the search configuration, or configure the search engine accordingly
- HTTPS vs HTTP mismatch: OpenSearch’s security plugin enables HTTPS by default in many installs
- Firewall or Docker networking: the hostname differs inside containers (for example
opensearchinstead oflocalhost)
Test from the Magento server itself with curl to the configured host and port.
Error: index read-only / “FORBIDDEN/12/index read-only / allow delete”
The search engine blocks writes when the disk is almost full (the flood-stage disk watermark). Reindexing fails.
Fix:
- Free disk space (old logs, backups, unused indices)
- Remove the block from indices:
curl -X PUT "http://localhost:9200/_all/_settings" -H 'Content-Type: application/json' -d '{"index.blocks.read_only_allow_delete": null}'
Recent versions remove the block automatically when disk usage drops, but freeing space is always step one.
- Reindex:
bin/magento indexer:reindex catalogsearch_fulltext
Error: circuit breaking exception / “Data too large”
The search engine does not have enough heap memory for the request.
Fix:
- Increase the JVM heap (in
jvm.optionsor theOPENSEARCH_JAVA_OPTSenvironment variable). A common rule is to give the heap up to half of the available RAM on a dedicated server, and keep minimum and maximum heap equal - Make sure the server has enough RAM in total; the search engine competes with MySQL and PHP on single-server setups
Products missing from search or category pages
Causes:
- Reindex not run or failed: check
bin/magento indexer:status - Product not visible in search (visibility setting), disabled, out of stock with “display out of stock” off, or not assigned to the website
- Cron not running, so “Update by Schedule” indexers never process changes
Fix:
bin/magento indexer:status
bin/magento indexer:reindex catalogsearch_fulltext
bin/magento cache:flush
And check that cron runs (see the Magento 2 commands cheat sheet).
Error: “Result window is too large”
Occurs on large catalogs when someone pages very deep into results.
Fix: keep index.max_result_window at a sensible level and limit how deep pagination can go in the frontend, rather than raising the limit very high.
Reindex is very slow
- Search engine on slow disks or with too little heap
- Too many searchable attributes: review which attributes really need “Use in Search” and “Use in Layered Navigation”
- Batch size settings and parallel reindexing in newer Magento versions
- MySQL performance during the data collection phase
Upgrading from Elasticsearch to OpenSearch
When upgrading Magento, you may need to move from Elasticsearch to OpenSearch:
- Check which versions your target Magento release supports (see how to upgrade Magento 2)
- Install OpenSearch alongside the old engine on staging
- Switch Magento configuration to OpenSearch
- Run a full reindex
- Test search, layered navigation and sorting
Also check extensions that talk directly to Elasticsearch (advanced search modules) for OpenSearch compatibility.
Prevent problems
- Monitor cluster health, disk usage and heap memory
- Give the search engine dedicated memory
- Keep disk usage well below the watermarks
- Rotate logs
- Run regular reindex checks after imports
Frequently asked questions
Can Magento 2.4 run without OpenSearch or Elasticsearch?
Magento 2.4 requires a supported search engine. MySQL search was removed in 2.4.
Should the search engine run on the same server as Magento?
For small stores it can. For larger stores, a separate server or managed service avoids memory competition and improves stability.
Why is layered navigation empty after a reindex?
Often because the reindex failed partway, or the search engine was not reachable during it. Check logs and reindex again.
Need help with Magento search?
I fix OpenSearch and Elasticsearch problems, tune search performance and handle Magento upgrades. See my Magento 2 and Hyvä service or request support.