3

I installed elasticsearch and the Magento backend connection test to elasticsearch is successful. If I save settings, clear the cache and reindex as described in the Magento devdocs, all product cateogries are empty and my search function has no result, whatever I type in there. I can still access the products with the direct url, thats all. If I switch back to MYSQL as search engine and clear the cache all products are back. Both Magento and Elasticsearch are Ubuntu18.04 servers, Magento 2.3.2 and Elasticsearch 6.8.3. Any idea where I can take a deeper look or how this problem can be solved?

EDIT: Some product attributes were not enabled for search (but not all! So there must have been results before). I reindexed and now the ES shows very good results! But as before, product pages are empty.

EDIT 2: Its a Multistore. The website id 1 works with ES, all other websites have no search results – and everywhere empty categories.

4
  • Change one of the category layout from admin. Empty layout or no design updates may create issue
    – sandip
    Sep 28, 2019 at 12:13
  • All categories were set to use the parent category setting, and the parent category is set to 1 column layout. Changes in any way do not lead to a changed behavior of the category content – they are still empty but I can see different column layouts depending on my choice ;-) Sep 28, 2019 at 14:06
  • Refer elastic search logs, and Put some logs on below class. This will ensure that ES is returning some products github.com/magento/magento2/blob/2.3/app/code/Magento/…
    – sandip
    Sep 28, 2019 at 14:26
  • 1
    I saw some product attributes were not enabled for search. Now I reindexed and the search shows very good results! But still, product pages are empty. Sep 28, 2019 at 14:47

3 Answers 3

1

Some issues are still with sorting when an elastic search is using as a catalog search engine. To resolve it, you can apply below patch specifically to Magento 2.3.2 and Elasticsearch 6+.

Go to the below file and add a plugin on the below class.

Magento\Elasticsearch\Model\ResourceModel\Fulltext\Collection\SearchResultApplier.php

Find apply() method and replace it with the below function. This is hotfix introduced by Magento recently by adding $this->collection->setPageSize(null); to the SearchResultApplier.php class.

    public function apply()
    {
        if (empty($this->searchResult->getItems())) {
            $this->collection->getSelect()->where('NULL');
            return;
        }
        $ids = [];
        foreach ($this->searchResult->getItems() as $item) {
            $ids[] = (int)$item->getId();
        }
        $this->collection->setPageSize(null);
        $this->collection->getSelect()->where('e.entity_id IN (?)', $ids);
        $orderList = join(',', $ids);
        $this->collection->getSelect()->reset(\Magento\Framework\DB\Select::ORDER);
        $this->collection->getSelect()->order("FIELD(e.entity_id,$orderList)");
    }
5
  • Hello, Do you know about how to add custom filter when apply elasticsearch? It's proper working in mysql. When I set elasticsearch, My custom filter not display in layered navigation. Jan 30, 2020 at 11:59
  • @RohanHapani Sorry do not have a proper answer on that. You can do a couple of things like 1. check elasticsearch mappings and make any changes into it 2. try to change ElasticVersion upgrade maybe help. I saw ur que while back. For Custom Filter, it needs more work if it not reflected in the current ElasticSearch mappings.
    – sandip
    Jan 30, 2020 at 12:19
  • If you have any answer. then please post here. magento.stackexchange.com/q/301847/51810 Jan 30, 2020 at 12:24
  • Hi @RohanHapani do you find solution for applying custom filter in category page with elasticsearch ?
    – aravind
    Dec 30, 2020 at 12:18
  • HI @RohanHapani also I need to display out of stock product at end of collection in category page, it is working fine in Mysql Search but not in Elasticsearch.
    – aravind
    Dec 30, 2020 at 12:33
1

Answer after some time: It was due to the simple fact that Elasticsearch was started, running for a short time and then crashed in silence.

Elasticsearch costs a lot of RAM (about half of your machine if not configured for less RAM usage) and indexation can cost a lot of RAM which then let Elasticsearch crash and all product categories were empty.

0

In my case,
The issue is happened because of 2 attribute “jajuma_product_latitude” and “jajuma_product_longitude“ don’t show in store view.
I’ve change 2 parameters of this 2 attributes and run this command:

php bin/magento c:f && php bin/magento indexer:reindex

And the products are show as expected in categories.

enter image description here enter image description here
Hope it help.

Your Answer

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

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