0

I want to use Magento 2.4.1 in a shared server, the problem is that the shared server is not support Elasticsearch. Is there any way to can remove the Elasticsearch or to disable the entire search functionality?

Thank you

2
  • Here is a great module to disable entire search functionality from magento 2.4 github.com/yireo/Yireo_RemoveSearch Commented Jan 28, 2021 at 9:13
  • A better solution might be renting an Elasticsearch server from an other hoster and connect your Magento to that. Magento and Elasticsearch don't need to run on the same server. You could for example use Elasticsearch Service by AWS Commented Jan 28, 2021 at 10:14

3 Answers 3

2

As you want to remove entire Elastic search and Magento Search functionality so you can use below steps.

Recommend to install this module on development instance using Composer only.

This module won't work on app/code directory.

This may break website GraphQL/REST APIs endpoints as well after installation.

What module actually doing

  • This module will remove modules mentioned in the replace property so it won't be there.

Based on this repo - I have listed down steps:

Register this module in your composer.json file:

composer require yireo/magento2-remove-search --no-update

Open up the composer.json file and add the following manually to your configuration:

"replace": {
    "magento/module-advanced-search": "*",
    "magento/module-catalog-search": "*",
    "magento/module-elasticsearch": "*",
    "magento/module-elasticsearch-6": "*",
    "magento/module-elasticsearch-7": "*",
    "magento/module-inventory-catalog-search": "*",
    "magento/module-inventory-elasticsearch": "*",
    "magento/module-search": "*",
    "elasticsearch/elasticsearch": "*"
}

Run composer update

If this fails, do the following(beware of its consequences).

rm -r vendor/ composer.lock
composer install

this is the only known workaround to get the composer replace trick working. Here you may face some consequences.

make sure to enable the module

php bin/magento module:enable Yireo_RemoveSearch
rm -r generated/ var/cache
php bin/magento cache:flush

Wipe out Redis if needed

redis-cli flushall 

To make sure that everything is working or not, try to execute below commands:

php bin/magento setup:upgrade
php bin/magento setup:di:compile

For more detailed guide and before taking any action, visit README.md - https://github.com/yireo/Yireo_RemoveSearch#yireo_removesearch

1

If you can remove elastic search then require below extension and it's install using composer

https://github.com/zepgram/module-disable-search-engine

composer require zepgram/module-disable-search-engine --no-update

Sometimes it is also needed to remove the vendor/ folder and the composer. lock file. It is all needed to force composer to recalculate all dependencies.

Before enabling, check the composer.json file because this extension removed the below extension from the vendor.

magento/module-advanced-search
magento/module-inventory-elasticsearch
magento/module-elasticsearch
magento/module-elasticsearch-6

But We need the this module for search "magento/module-advanced-search"

After the module below, enable using the below command.

php bin/magento module:enable Zepgram_DisableSearchEngine

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento setup:di:compile
php bin/magento cache:flush
php bin/magento cache:clean
php bin/magento indexer:reindex
sudo chmod -R 777 var/ generated/ pub/media/ pub/static/

After that you need the MYSQL Search engine for searching. So you can install from below the github URL and follow the installation step.

https://github.com/swissup/module-search-mysql-legacy

Also, you can install the following steps below.

composer require swissup/module-search-mysql-legacy

php bin/magento module:enable Swissup_SearchMysqlLegacy Swissup_Core

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento setup:di:compile
php bin/magento cache:flush
php bin/magento cache:clean
php bin/magento indexer:reindex
sudo chmod -R 777 var/ generated/ pub/media/ pub/static/
0

As of Magento 2.4.x, it is required to use Elasticsearch for the search functionality as MySQL is no longer supported (please check the official release notes details regarding backward incompatible changes).

Please take into consideration that the category pages sorting and filtering also rely on Elasticsearch, so I don't quite imagine how you still have a functioning website without Elasticsearch, unless you do some heavy customizations.

Would it be maybe possible to install Elasticsearch on a different server and then connect Magento to that one?

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.