Your Magento store runs fast but the search still loads slow and takes 10-15 seconds to complete. How do you deal with that? Ugh, why can’t Magento just work? What do we need to do to bring Magento 2 search below the 1-second mark?
We’ve all been there. Sometimes the solution is simple, sometimes not so much. First, let’s see why the Magento search loads slow followed by detailed tips on how to make things right.
The default Magento search engine works fine with a small number of products and a simple store. Once you start piling up customizations, add new data and products, things get complicated and Magento search loads slow.
A few factors are in place here:
- more store data commands more raw hardware power to search,
- the default Magento 2 search engine works well only with small amounts of data and low search loads,
- new features and customizations take more resources to process, this means Magento has to somehow allocate resources in a fair way between search queries and other Magento needs.
Search can become slow for 3 main reasons:
- poor search engine choice,
- bad search engine configuration,
- hardware and hosting bottlenecks.
As we’ve outlined the main 3 causes of Magento search low-performance issues, we will move to the 7 major solutions.
By default, Magento 2 will use MySQL full text for search operations. It’s not always a bad idea to use the default search engine, it’s just not an optimal solution. Even if you have a small store without loads of products and attributes, you should switch to something else as soon as possible. Magento MySQL search doesn’t support a lot of quality of life features: instant search, typo corrections, prioritization, etc.
As we’ve already mentioned, the default Magento search is an easy way to slow down your store-wide search to a halt when you deal with large amounts of data. And although MySQL search can handle complex queries and high loads, it’s poorly optimized to search a part of a string inside the whole string. Trying to solve this problem, multiple companies have created their own versions of search engines that work way better with typical Magento loads.
There are two big groups of solutions with different price tags, concepts, and features. We can roughly divide all search solutions into self-hosted search engines such as Elasticsearch or Solr and SaaS offerings like by Algolia, SearchSpring, and FactFinder.
We will look closer into the main differences between them but for now, it’s important to note that all custom-built search engines outperform default MySQL search inside your Magento store.
So the answer is always YES. Switch to a faster and better Magento search engine as soon as possible.
In the 2020s, Solr, Sphinx, Xapian, and others are less relevant. So we will focus on Elasticsearch which has been considered the best Magento search solution for a while now.
Elasticsearch received integral support of Magento 2 within the last few versions. It’s a well-known solution to speed up Magento and its search. It is a decent upgrade path from the default Magento search engine. One of the biggest advantages of Elasticsearch is that it’s self-hosted, cost-effective, and works out of the box.
With Elasticsearch, you’ll definitely see the speed gain in addition to:
- multilanguage support,
- customizable stopwords for any locale,
- synonyms support,
- zero impact search indexing,
- horizontal scalability,
- a ton of ready to use search plugins,
- can be used “as is” after the install.
Magento 2.3 supports Elasticsearch 5.0+ and 6.0+ so you have some choice here. It’s obviously beneficial to use the latest version (Elasticsearch v7.4 as of the release of this article).
So should you choose a self-hosted Magento search engine to improve search time? 90% of the time, the answer is YES. YES, you should.
Use Elasticsearch if you want to save money on yet another subscription or don’t need a super-fast search anyway. After all, if your search works under 300 ms, you are good.
Note, even though Elasticsearch is the best Magento search solution, it is relatively harder to integrate into Magento compared to a SaaS solution. You’ll have to hire someone or know exactly what you are doing to (preferably) install it on a separate server and then connect to your current store.
In contrast to Elasticsearch and other self-hosted solutions, SaaS Magento search engines are maintained as a subscription service. With the pay-as-you-go model, they often command pretty high prices on a monthly basis. Depending on the size of your business, a SaaS solution can become either a good investment of money or a fancy money sink.
If you compare these two approaches to implementing in-store search, SaaS is like an expensive sports car and a self-hosted search engine is a factory-built workhorse capable to become a real beast in the right hands.
Talking about the most prominent SaaS search engines, it’s hard not to mention Algolia, Amazon CloudSearch, Fact-Finder, and Swiftype. SaaS solutions often feature some kind of smart search output, offer the ability to self-prioritize search results for the best customer experience, and focus on high scalability.
For example, Algolia claims they have a single idea in mind: performance. Achieve faster Magento search and reduce latency, this is the motto. In addition to that, smart search capabilities range from interpreting typos and widely using synonyms in search results.
Most of the time, a SaaS solution will be faster than a self-hosted search engine. Not always technically faster, though. SaaS search suffers from latency issues because in some unlucky cases the distance between your server and a SaaS search machine can “eat up” all the benefits of running a SaaS service. In this case, you end up paying for 0 performance gain.
A SaaS solution isn’t integrated as closely into Magento, either. Basically, SaaS is a more configurable, hands-on, expensive Elasticsearch alternative. If we compare Elasticsearch and Algolia, the difference is that Algolia excels at being extremely fast, easy to integrate, and really good at keeping indexes in sync. Most of the time the solution is integrated into Magento via a third-party extension.
Do keep in mind that with Algolia it’s pretty easy to reach into a higher pricing tier where payments start from 500$/month for the service and scale up with the load. So when you look for that additional oomph! for your search, take into consideration the price build-up, too.
Full disclosure, if we are talking about cost-to-deploy, Elasticsearch also comes with its own expenditure. It won’t cost you a dime to deploy on your own servers but if your store is hosted on Amazon Web Services, prepare to pay AWS for Elasticsearch capabilities. The same goes for Elastic Cloud.
For a lot of Magento store owners, the key deciding factor is the price so most of the time they stick with Elasticsearch.
So should you use a SaaS solution to make Magento search faster? YES, but take the price into consideration. SaaS offers are designed for major stores that won’t be unpleasantly surprised at the enterprise-level price tag that often accompanies such an offer. Investing thousands of dollars a month into a single store feature will ensure your search is top-notch.
Use SaaS if your search operation count reaches millions but it still needs to be lightning-fast (for example, Algolia claims to be 200x faster than Elasticsearch in some use case scenarios).
For self-hosted solutions, moving to a separate server allows you to solve performance issues. More raw power is always good. Just make sure you really need it. It’s entirely possible that after you migrate search to a new place your latency overhead will eat up all the benefits of hosting search outside the main store. Server back-and-forth can be noticeable and it’s an inevitable part of moving away from a monolithic infrastructure.
So the answer is YES if the search load is big enough to warrant a separate machine (meaning you have a huge store with loads of data).
The answer is NO if the search load is manageable within the capabilities of the current server (small to medium stores won’t benefit from the move).
Companies that specialize in hosting Magento stores will offer Magento-optimized servers which is always a great perk. Another great perk is that these hosters often provide search engine servers for Magento, be it for Elasticsearch, for Solr, or for something else.
In addition to that, hosters who specialize in Magento will know best what kind of hardware server capabilities will be optimal for your store, help troubleshoot performance issues, speed up the Magento Admin Panel, etc.
So will your Magento search become faster if you move to a Magento-focused hosting? Most likely, YES. In addition to easy search engine integration capabilities, you get a competent team who knows how Magento is different from other e-commerce platforms and its unique challenges. Good Magento hosting examples would be Sonassi, Cloudways, and Nexcess.
If we are talking about the latest Magento version, then yes. Magento 2.3 supports Elasticsearch v5.0+ and v6.0+ natively which means you don’t have to use third-party extensions in order to install and connect Elasticsearch to your store.
So the answer is YES, upgrade to Magento 2.3.0 or later to gain better Elasticsearch compatibility.
Most of the time people will claim Elasticsearch works well outside the box. Which is totally true. It’s a robust solution that will work great even if you leave it to its own devices. But if you put in a bit of time and effort into customizing your Elasticsearch setting to your store, it will be a great boost to how users experience your search.
Bear in mind that these improvements don’t necessarily get you faster Magento search, just better. There is a difference between a fast search and a good search. For example, in Elasticsearch you can experiment with fine-tuning attribute weights in search results. Let’s imagine you want customers to find “heels” not only when the product name has this word but so that Magento could show all relevant products that have heels anywhere in the product.
Improving search in such a way is a welcome opportunity to boost sales without spending money on promotions, ads, or designers. So YES, use every opportunity to make your store search not only faster, but better. Tweaking Elasticsearch settings could be challenging but rewarding. And if you aren’t sure how to make it better, we offer Magento optimization services and are always ready to help.
Search is one of the most important features of any online store. Of course, as you aim for your store to reach the best Magento performance and PageSpeed, you rework many parts of the site and optimize images. But search is the next vital part that deserves attention. Customers who use the search immediately from the homepage:
- know exactly what they want,
- are ready to make a purchase,
- want to buy right now, you don’t need to convince them.
If your search is fast and efficient, you get better sales and outperform the competition. So let’s repeat one more time what to do if your Magento search loads slow:
- switch from default Magento search engine to Elasticsearch or a SaaS,
- find a good hoster who also specializes in Magento and (optimally) offers Magento search engine hosting,
- update to Magento 2.3.x or later to get easy Elasticsearch built-in support,
- move your search engine to a separate server to make it faster,
- customize your search engine to sell more products.