The benefits of using ElasticSearch for your eCommerce business
Powerful, flexible and reliable search engine is a must-have for an e-commerce store, especially when large amounts of data are involved. The easier and faster customers are able to find what they are looking for, the more likely they are to purchase something in your store.
ElasticSearch is able to execute complex queries extremely fast. It also caches almost all of the structured queries commonly used as a filter for the result set and executes them only once. For every other request which contains a cached filter, it checks the result from the cache. This saves the time parsing and executing the query improving the speed.
Lots of search options
ElasticSearch implements a lot of features when it comes to search such as customized splitting text into words, customized stemming, faceted search, full-text search, auto-completion, and instant search. Also, fuzzy search is good for spelling errors. You can find what you are searching for even though you have a spelling mistake. Auto-completion and instant search refer to searching while the user types. It can be simple suggestions of existing tags, trying to predict a search based on search history, or just doing a completely new search for every keyword.
As ElasticSearch has a distributed architecture it enables to scale up to thousands of servers and accommodate petabytes of data. The customers then need not manage the complexity of distributed design as it has been done automatically.
Often, you have multiple customers or users with separate collections of documents, and a user should never be able to search documents that do not belong to them. This often leads to a design where every user has their own index. Often, this leads to having too many indexes. One larger ElasticSearch index is actually better.
Numbers, text, geo, structured, unstructured. All data types are welcome.
How to integrate ElasticSearch with Spree
There are 3 popular Rails gems which you can use to integrate ElasticSearch with your Spree application:
All of them can be easily integrated thanks to the well-designed Spree’s database schema. What’s more, Spree provides an abstraction for implementing products search (check out https://github.com/spree/spree/blob/master/core/app/models/spree/app_configuration.rb#L70). If you want to implement a search of other entities, just follow the instructions provided by the gems – Spree is just a regular Rails app so there shouldn’t be any additional problems.
It doesn’t matter which gem you’ll choose – the integration will go smoothly. Spree models are so flexible that adding a search layer is not big deal. – Piotr Leniec, Senior Fullstack Developer, Spark Solutions
Example of ElasticSearch and Spree integration
Greetabl is an online one-stop-shop for creatively-curated gifts and greetings that are personalized with Instagram photos, packaged and sent in just a few clicks. The company uses Spree for its eCommerce platform and ElasticSearch for quickly searching and filtering millions of records.
Read more: Greetabl’s Success Story