Before I enabled ElasticSearch the search bar would give me a list of categories, products, and blog posts that matched. And when I hit enter the search results page would contain the matching products.

After I enabled ElasticSearch the search term suggestions show, but the results page contains no products. Oddly if I do an "advanced search" (/catalogsearch/advanced) I do get the results I would expect.

I'm using Magento 2.3.4 with ElasticSearch 6.8.7.

I've done the following on my test server to try to diagnose the problem:

  • Configured and setup ElasticSearch.
  • Configured Magento according to the Magento documentation, I get the "Successful! Test Again?" button
  • Run bin/magento indexer:reindex
  • Installed kibana to make sure I can see and search the data in ElasticSearch, I can.
  • Switched to the luma theme to eliminate the theme as the issue.
  • Checked log files for new error message (error, exception, system). No messages were generated doing searches besides access log messages.

If anyone has any suggestions or advice I'd greatly appreciate it.

Thanks, Brian


3 Answers 3


Give a try below to check atleast if ElasticSearch returns some results or not?

File: Check\Es\etc\di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="Magento\Elasticsearch\SearchAdapter\ResponseFactory">
      <plugin name="ESChecker::willReturnsDocuments" type="Check\Es\Plugin\ESResponseCheck" sortOrder="1" disabled="false" />

File: Check\Es\Plugin\ESResponseCheck.php

namespace Check\Es\Plugin;

use Magento\Elasticsearch\SearchAdapter;
use Psr\Log\LoggerInterface;

class ESResponseCheck

    protected $logger;

    public function __construct(
        LoggerInterface $logger        
    ) {
        $this->logger = $logger;


    public function beforeCreate(\Magento\Elasticsearch\SearchAdapter\ResponseFactory $subject, $result)
       if(!is_array($result) || empty($result)) return false;
       foreach ($result['documents'] as $rawDocument) {


Clear the cache and catalog search reindexing

Perform any search terms and check var/debug.log file found in the Magento root directory.

In the debug.log file look for the product IDs returns from the ElasticSearch.

Also, check below URL for further info - https://magento.stackexchange.com/a/285358/34579

  • Thanks for the suggestion, we verified that we were getting results from ElasticSearch. Commented Apr 6, 2020 at 23:21
  • Glad to see that.
    – sandip
    Commented Apr 7, 2020 at 2:11

After some discussion with a co-worker we disabled all modules and re-enabled them one at a time. This led us to some custom code that was designed specifically for the mysql search. The offending part of the module was in:


Once we removed that file, recompiled and reindex the data the search was working.


I had exactly the same issue and behaviour as stated in the question, including a change to the search using a search_request.xml file, however after nothing worked and I dove a little deeper in the debug log, ES was complaining about "illegal_argument_exception" and asked me to set "fielddata=true".

I followed this document(support.magento.com) which is still valid for Mage 2.4 w/ ES 7.16.

Leaving this here for future reference as this question is the first Google result, and I think Magento.com is a solid and credible enough source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.