Introduction
In the realm of web development, particularly with Magento 2, Elasticsearch has become a default requirement for search functionalities. However, for development purposes or to cut down costs, many developers seek alternatives to Elasticsearch. One effective solution is using Swissup’s MySQL Legacy Module. This blog will guide you through the process of installing Magento 2 without Elasticsearch by leveraging this module.
Why Avoid Elasticsearch?
Elasticsearch, while powerful, can be resource-intensive and adds additional costs, especially when using cloud-based services. For developers working on local or development environments, using a lightweight alternative like MySQL for search functionalities can streamline the setup process and reduce overhead.
Introducing Swissup’s MySQL Legacy Module
The Swissup MySQL Legacy Module enables Magento 2 to utilize MySQL as the search engine, bypassing the need for Elasticsearch. This module is particularly useful for development environments or smaller Magento installations where Elasticsearch’s advanced features are not necessary.
Step-by-Step Installation Guide
Here’s a detailed guide on how to install and configure the Swissup MySQL Legacy Module for Magento 2:
1. Configure Composer Repository
First, add the Swissup repository to your Composer configuration:
composer config repositories.swissup composer https://docs.swissuplabs.com/packages/
2. Install the Module
Next, require the module via Composer:
composer require swissup/module-search-mysql-legacy --prefer-source --ignore-platform-reqs
3. Enable the Module
Once the module is installed, enable it along with the Swissup Core module:
bin/magento module:enable Swissup_SearchMysqlLegacy Swissup_Core
4. Upgrade Magento Setup
Run the setup upgrade command to update the Magento configuration and database:
bin/magento setup:upgrade --safe-mode=1
5. Compile Dependency Injection
Compile the dependency injection configuration:
bin/magento setup:di:compile
6. Reindex Catalog Search
Reindex the catalog search to apply the new search engine:
bin/magento indexer:reindex catalogsearch_fulltext
7. Set MySQL as Search Engine
Finally, configure Magento to use MySQL as the search engine:
bin/magento config:set catalog/search/engine 'lmysql'
Conclusion
By following these steps, you can successfully set up Magento 2 to use MySQL for search functionalities, eliminating the need for Elasticsearch. This setup is particularly beneficial for development environments, offering a simpler and more cost-effective solution.
Benefits Recap
- Cost Efficiency: Avoids the additional costs associated with Elasticsearch.
- Simplicity: Easier setup and maintenance, especially in local or development environments.
- Performance: Sufficient for smaller installations or development purposes.
Further Reading and Resources
Feel free to reach out in the comments if you have any questions or need further assistance with your Magento 2 setup!