I'm trying to setup Elastic Search on an existing catalog that works fine under standard MySQL search. I go through the documentation and it seems straightforward. This is Magento 2.3.2 and ElasticSearch 6 (version 6.7.1).

The documentation says to just select it and reindex. It feels like there must be some extra step that I'm not clear on. After doing so, all I get on every category page is "We can't find products matching the selection."

I've done all of the basics (clearing all caches and temp files, reindexing). The solution found here is not a change to what my file already has (copied below). Again, these are established categories and they are all empty.

What am I missing? Or, what should I be looking for?

Edit: if it helps here is the result of curl -i http://localhost:9200/_cluster/health

HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 389


Edit: Per the comment below I've included the source of the file vendor/magento/module-elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php:

This is Magento 2.3.2 and I don't make local edits to vendor files.

    namespace Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection;
    use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplierInterface;
    use Magento\Framework\Data\Collection;
    use Magento\Framework\Api\Search\SearchResultInterface;
     * Resolve specific attributes for search criteria.
    class SearchResultApplier implements SearchResultApplierInterface
         * @var Collection|\Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection
        private $collection;
         * @var SearchResultInterface
        private $searchResult;
         * @param Collection $collection
         * @param SearchResultInterface $searchResult
        public function __construct(
            Collection $collection,
            SearchResultInterface $searchResult
        ) {
            $this->collection = $collection;
            $this->searchResult = $searchResult;
         * @inheritdoc
        public function apply()
            if (empty($this->searchResult->getItems())) {
            $ids = [];
            foreach ($this->searchResult->getItems() as $item) {
                $ids[] = (int)$item->getId();
            $this->collection->getSelect()->where('e.entity_id IN (?)', $ids);
            $orderList = join(',', $ids);

Progress: In exceptions.log I have the error: "type":"query_shard_exception", "reason":"No mapping found for [position_category_#] in order to sort on"

The whole thing:

main.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [position_category_104] in order to sort on","index_uuid":"bLDcJEDeQ_eyRQOQYHppzQ",
"index":"magento2_product_1_v1"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v1","node":"ZGUdm6aHRU6RShqrqU3xfQ","reason":{"type":"query_shard_exception","reason":"No mapping found for [position_category_104] in order to sort on","index_uuid":"bLDcJEDeQ_eyRQOQYHppzQ","index":"magento2_product_1_v1"}}]},"status":400} {"exception":"[object] (Elasticsearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"query_shard_exception\",\"reason\":\"No mapping found for [position_category_104] in order to sort on\",\"index_uuid\":\"bLDcJEDeQ_eyRQOQYHppzQ\",\"index\":\"magento2_product_1_v1\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_product_1_v1\",\"node\":\"ZGUdm6aHRU6RShqrqU3xfQ\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"No mapping found for [position_category_104] in order to sort on\",\"index_uuid\":\"bLDcJEDeQ_eyRQOQYHppzQ\",\"index\":\"magento2_product_1_v1\"}}]},\"status\":400} at /opt/bitnami/apps/magento/htdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:636)"} []
  • post this file code - Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier.php
    – sandip
    Nov 11 '20 at 16:02
  • What is the output of the curl http://localhost:9200/_cat/indices command execution against your ES instance? Mar 5 at 8:24

I was able to fix this by renaming the index. It was by default named "magento2" and I renamed it to "mydomain". Did that and reindexed and the error went away. My guess right now is that reindex wasn't taking for some reason on the default index.

(Stores -> Configuration -> Catalog -> Catalog -> Catalog Search -> Elasticsearch Index Prefix)

I was asked for the results of curl http://localhost:9200/_cat/indices

Here it is now:

yellow open mydomain_product_1_v1     vAbKxQUiQkS7uHdmp-uDCg 5 1 1484 0 1.3mb 1.3mb
yellow open magento2_product_1_v1     bLDcJEDeQ_eyRQOQYHppzQ 5 1    0 0 1.2kb 1.2kb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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