On this page
Resolving Magento 2 OpenSearch/Elasticsearch errors causing broken search and category pages
Broken search results and blank category pages in Magento 2 are often caused by a lost connection to the search engine service or stale indexes.
Broken product searches and blank or error-prone category pages in Magento 2 are almost always caused by a problem with the search engine service - either a lost connection, a stale index, or a mapping mismatch after an upgrade. This guide walks you through diagnosing the problem and fixing it, in most cases without needing to raise a ticket at all.
On our hosting, the search service runs as a dedicated instance on your own account, managed through the ElasticSearch plugin in cPanel. The plugin is named after the original software, but on current versions it runs OpenSearch, the open-source fork that modern Magento releases use. You can check its status, view your connection details, and restart it yourself - all covered below.
Recognise the symptoms
The following signs typically point to a search engine problem rather than a theme or code issue:
- A 500 error on category pages or the search results page
- A blank or partially rendered category page with no products listed
- Product searches returning no results or a generic error message
- Errors in
var/log/exception.logorvar/log/system.logmentioningElasticsearch,OpenSearch,No alive nodes, orindex_not_found_exception
If you are seeing these symptoms, you are in the right place. Check your Magento logs first to confirm - the Magento 2 log locations article explains where to find them and how to read them.
Check the service in cPanel
Start at the service itself, because if it is down, nothing in Magento will help until it is back.
- Log in to cPanel and open ElasticSearch (search for it in the Tools page).
- Check the status banner at the top. It should read Active, alongside the version your account is running.
- If the service is not running, or is running but unresponsive, restart it: in the Danger Zone section, click Disable to stop the service, wait a few seconds, then enable it again. Your data and configuration are preserved - disabling only stops the service.
- While you are here, note the Connection Details panel: the host, port and version shown there are exactly what Magento needs, and there are copy buttons next to each.
The port is unique to your account, which matters in the next step.
Check the connection in the Magento admin
With the service running, confirm Magento can reach it using the built-in connection test.
- Log in to your Magento admin panel.
- Go to Stores > Configuration > Catalog > Catalog Search.
- In the Search Engine dropdown, select the engine matching your setup. On current Magento releases (2.4.6 and later) running OpenSearch, choose OpenSearch. On Magento 2.4.4 and 2.4.5, OpenSearch is connected using the Elasticsearch 7 option instead. Older stores still running a legacy Elasticsearch version should select the option matching that version.
- Set the Server Hostname to
127.0.0.1and the Server Port to the port shown in the cPanel ElasticSearch plugin's Connection Details panel. - The Index Prefix can normally stay at its default. If you run more than one Magento installation on the same hosting account, give each a different prefix so their indexes never collide.
- If you have enabled authentication in the cPanel plugin, set Enable HTTP Auth to Yes here and enter the matching username and password.
- Click Save Config, then Test Connection.
If the test returns a green success message, the service is reachable and the problem is likely a stale or broken index - continue to the reindexing section below.
If the test fails and your settings match the plugin's Connection Details exactly, restart the service as described above and test again. If it still fails, contact our support team with the error message shown.
After changing any Catalog Search settings, always click Save Config before running the connection test again.
Re-run indexers after the service recovers
Even once the connection is working, search and category pages can stay broken until Magento rebuilds its search indexes. A recovered service does not automatically trigger a reindex.
From the command line (SSH)
Reindexing on demand in Magento 2 is done from the command line. To rebuild everything:
php bin/magento indexer:reindex
To rebuild only the catalog search index:
php bin/magento indexer:reindex catalogsearch_fulltext
Our essential Magento 2 SSH commands article covers these and other useful CLI commands in more detail.
From the Magento admin
The admin cannot run a reindex on the spot - System > Index Management only lets you change indexer modes and, on Magento 2.4.6 and later, mark indexers as invalid via the Invalidate index action. An invalidated indexer is rebuilt automatically the next time Magento's cron runs, so this works as a slower alternative to SSH, provided your cron jobs are running (see below).
Large catalogues can take a significant amount of time and memory to reindex. If the process fails with a memory error, your PHP memory_limit may be too low - check it via the Select PHP Version tool in cPanel (see how to manage the PHP version in cPanel), or run the command with a one-off higher limit: php -d memory_limit=2G bin/magento indexer:reindex. If reindexing still fails, contact our support team.
Flush the Magento cache after reindexing
Once reindexing completes, flush the Magento cache so the updated indexes are served to visitors:
php bin/magento cache:flush
Or from the admin: System > Cache Management, select all cache types, and choose Flush Magento Cache. If you use LiteMage as your full-page cache, flush that too from the same Cache Management page - a cached page can make a successful fix look like it has not worked.
Fix index mapping mismatches after setup:upgrade
If you have recently run setup:upgrade - for example after a Magento update or extension install - you may find that search errors persist even though the connection test passes. This is usually caused by index mappings being out of sync between Magento and the search engine.
Check var/log/exception.log for messages like index_not_found_exception or mapper_parsing_exception. If you see these, the fix is to force a clean rebuild:
php bin/magento indexer:reset catalogsearch_fulltext
php bin/magento indexer:reindex catalogsearch_fulltext
The reset command marks the index as invalid; the reindex command then builds a fresh index with the correct mappings and switches Magento over to it. After reindexing, flush the cache again.
Check that cron is running
Magento can be configured to use scheduled (cron-based) indexers rather than running them on demand. If cron is not working, indexes will never update automatically and problems will keep recurring after you fix them manually.
If you are relying on scheduled reindexing, make sure your Magento cron job is set up and running correctly in cPanel. Go to cPanel > Cron Jobs and confirm the Magento cron entry is present. See how to set up a cron job in cPanel if you need to create or check one.
A note on versions
The cPanel ElasticSearch plugin includes a Version Management section that lets you switch the search engine version your instance runs. Each Magento release supports specific search engine versions, so check compatibility for your Magento version before changing it, and expect to reindex afterwards. If you are unsure which version to run, contact our support team and we will advise.
When to contact us
Contact our support team if any of the following apply:
- The service will not return to Active in the cPanel plugin after disabling and re-enabling it
- The Test Connection check fails even though your settings match the plugin's Connection Details
- Reindexing fails repeatedly even after raising the PHP memory limit
- You see persistent errors in the Magento logs that suggest the search service is unavailable
When you raise a ticket, include the error message from the Test Connection screen or from var/log/exception.log - this helps us diagnose the problem faster. You can create a support ticket in MyKualo at any time.