Your store runs fast but the search still 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 Magento search loads slow.
What Causes Slow Magento Search Speed?
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.
A few factors are in place here:
- more store data commands more raw hardware power to search,
- 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.
How to get Faster Magento Search?
As we’ve outlined the main 3 causes of Magento search low-performance issues, we will move to solutions.
Should You Switch to an Alternative Search Engine?
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. 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 the like of 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.
Should You Choose a Self-Hosted Magento Search Engine?
In 2019, Solr, Sphinx, Xapian, and others are less relevant so we will focus on Elasticsearch which has been an undisputed market leader for some time now.
Elasticsearch received integral support of Magento 2 within the last few versions. It’s a well-known solution to speed up search and 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.3.1 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. Elasticsearch 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.
Should You Choose a SaaS Magento Search Engine?
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 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 benefit 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 an 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. 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 into millions but it still needs to be lightning-fast (for example, Algolia claims to be 200x faster than Elasticsearch in some use case scenarios).
Should You Move Your Search Engine to a Separate Server?
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 monolith 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).
Should You Find a Magento-Focused Hoster?
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, 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.
Should You Update to the Latest Version?
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.
Should You Configure Elasticsearch Further or Leave It As Is?
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 are ready to help.
Faster Search, Better Sales
Search is one of the most important features of any online store. Customers who use 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 how to make Magento search faster:
- 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.