An exception is thrown on my search results page, but only for certain search text. If I search for "stov" (without the quotes), the results appear. If I search for "stove", an exception is thrown. There are several other search terms which work and don't work.

The instsance is Magento 2.4 using Elastic v7. Magento was recently upgraded from 2.3.5. I'm using a Porto theme and Wyomind extension for Autocomplete.

On the Elastic server, I put trace on inbound requests. When Magento produces this error, a search query does not reach the Catalog product index, in Elastic.

I rebuilt the index (indexer:reindex), and flush/clean the cache.

main.CRITICAL: Notice: Undefined index: hits in /chroot/home/.../vendor/magento/module-elasticsearch/SearchAdapter/Aggregation/Builder/Dynamic.php on line 63

Update 1: Could this be a memory issue, in Magento? I have a large catalog >500k items, running in a minimal environment, 2G. If it were a memory issue, would that show up in a log? I only see the error (above) in the system.log and exception.log.

Update 2: I've received the following error while trying to indexer:reindex catalogsearch_fulltext. I seem to be stuck on this point, unable to rebuild the index.

Catalog Search index process unknown error: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [position_category_1270] of different type, current_type [text], merged_type [integer]"}],"type":"illegal_argument_exception","reason":"mapper [position_category_1270] of different type, current_type [text], merged_type [integer]"},"status":400}

1 Answer 1


The issue was repaired by adding the code below to /app/code/Wyomind/ElasticsearchCore/Model/Adapter/Elasticsearch7.php, line 93, which is part of wyomind/elasticsearchautocomplete version 7.7.8

    $rawDocuments = $rawResponse['raw'] ?? ['hits' => ['hits' => []]];
    if (empty($rawDocuments['hits'])) {
        $rawDocuments['hits'] = ['hits' => []];
    if (empty($rawDocuments['hits']['hits'])) {
        $rawDocuments['hits']['hits'] = [];

The existing code was not handling the case where a search term did not return any search results. I'm not sure if this is a bug in Wyomind, or is the issue caused by the way I'm using it.

  • this solution working or not @Eric Bowden Commented Nov 9, 2020 at 10:10
  • Hi @RavindrasinhZala, yes, the solution above, resolved the issue. Commented Nov 10, 2020 at 11:25

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.