How Elasticsearch Helps to Build Advanced Search Engines on E-commerce Sites
Any e-commerce website, whether it's an online store or a marketplace, needs a convenient and simple search system. However, according to statistics, only 15% of companies pay due attention to this issue, and 42% don’t take care of optimizing the search space at all. So, with the right approach to the matter, you get a real chance to surpass 85% of your competitors.
In our article, we’ll tell you what an Advanced Search Engine is and how to create it with the help of the effective Elasticsearch tool. We’ll share useful tips based on our practical experience.
Why advanced search engine is important
The information retrieval problem remains relevant at all times, regardless of the type of site in question. And, of course, e-commerce resources should solve the above issue in the first place, because it directly affects the level of their sales.
Let's figure out why it's so important to implement a good data search engine.
Why is it so crucial?
In general, the answer may seem obvious, but let's go over it anyway:
- improved search experience (and in a sense, it's almost the same as the user experience). Visiting your site for the first time, the user won’t try to sort out your navigation in order to find the information he needs. Most likely, he’ll take advantage of the search a website has. And if your resource doesn't have one, or if it won’t cope with the custom search requests, then the visitor will leave. Do not believe us? Here are the statistics:
- after the first attempt to find what they're looking for through the search on the website (or app), 51% of users leave the resource;
- after the second attempt, 32% of users refuse to continue the search;
- the third unsuccessful attempt leads to the loss of another 18% of potential customers.
- higher conversions. Helping to increase search throughput, you're getting a chance to also increase the conversion level, as the graph below shows us.
Let's summarize: you need the Advanced Search Engine to get higher conversions and, therefore, profits. You save the client’s time, which means you increase the probability he'll stay and buy something. Otherwise, you’ll lose loyal visitors and, as a result, some of the income.
What do people search for?
When it comes to e-commerce projects, custom search requests include products or services of a particular market. And keep in mind that people express their thoughts differently, they use various synonyms and even make mistakes when writing. So you need a fuzzy search, which offers not only objects which are identical to the one the user is looking for but all of them that are similar to it by some criterion.
Anyway, first things first.
What Is the Perfect Advanced Search Engine?
What should one consider when creating an effective but simple search?
- Search with mistakes and synonyms. The task implies the creation of the fuzzy search which we have already spoken of. It means you should draw a list of possible user-defined search requests to simplify and optimize the search process. But we’ll talk about it later when discussing the Elasticsearch index.
- Search space. By default, the search space must include all of the site's content (but nothing beyond your resource)
- Search based on search history. Advanced Search Engine should remember what a visitor viewed (bought) to take into account his preferences when ranking results. It helps to improve the user search experience, to anticipate his desires, so to say.
- Quality of search. It includes:
- no identical pages in the search results
- sorting results by relevance
- providing useful clues or probing questions
- Modern search interfaces. Last but not least is the search design. Among the obvious can be mentioned:
- The search line should be placed on each site page. Typically, users expect to see it at the top of the screen.
- The search line must be different from other forms and fields and contain a minimum of 30 characters.
- The user should immediately understand that this is the search bar, and not something else.
How to add a fuzzy searching system to your site?
There are 3 ways to create a data search engine:
- Write your own script. This option is not bad, but very complicated and therefore expensive.
- Use the standard search of your CMS - each CMS has its algorithm. Alas, all templates leave much to be desired and rarely allow for a good result.
- Connect a third-party service. Such a solution is optimal in most cases. The main thing is to choose the right technology.
There are a lot of third-party services of the sort, each one has its pros and cons. We suggest using Elasticsearch in online marketplace projects.
As you can see, the statistics say the same: Elasticsearch for eCommerce sites and apps is the best option.
What is Elasticsearch?
So, Elasticsearch, what is it?
Elasticsearch is a horizontally scalable, open-source search engine implemented on the basis of the Apache Lucene library. The tool interacts with the outside world via the HTTP API, and the transfer and processing of data to Elasticsearch are being carried out through JSON.
Elasticsearch is a real-time search and analytics system whose main distinctive competitive advantages are flexibility and ease of use.
When is Elasticsearch a good choice?
Elasticsearch can easily be implemented in any e-commerce project. And by the by, the impressive list of its clients contain such world-known names as Adobe Systems, Facebook, Quora, Mozilla, GitHub, Netflix, Pixabay, and many others.
What does Elasticsearch consist of?
We offer to review the main elements of the structure of this third-party service to figure out why Elasticsearch for eCommerce is such a good thing.
Elasticsearch creates an index: a special database where the information collected by search robots from website pages (including visual and text content, all kinds of links, and so on.) is being placed. With each Elasticsearch query, the database is being accessed.
Such an approach greatly helps to remove the load from the server, simplify the processing of user requests, and enhance search performance.
By the by, inside the Elasticsearch index, each document can be organized according to the following structure element.
Here we’re talking about logical separation and grouping of data. Say, a blog (an application or web resource) should include such Elasticsearch types as articles and reviews (or others, if you have another vision of the matter).
By the way, Elascticsearch is built to handle unstructured data and can automatically determine the data types of document fields.
Elasticsearch’s aggregations are data slices made for a number of parameters. The aim is to obtain aggregated quantitative information collected in a certain way and stored separately in order to get quick results on user-defined search requests. An example of such aggregated quantitative information can be the number of pages for a certain Elasticsearch query (let us say, a query like "how to integrate Elasticsearch" or whatever).
Using aggregations in Elasticsearch makes this third-party service especially effective.
Clusters and nodes
In fact, a node is a separate process of the Elasticsearch service with its data and settings. Even if you have a single node, you can still form a cluster. But if there are several of them in the cluster, then the default index sharding and shards replication will increase the index stability and the speed of processing custom search requests due to redundancy and parallelization. Nodes act as one entity, which allows scaling and processing of the server load because each node (server) has only a piece of data.
Depending on the needs of your e-commerce project, you can add and remove nodes as necessary.
What are shards in Elasticsearch?
So, separate Elasticsearch clusters consist of nodes, and each node is a set of one or several shards, which allows storing information whose amount exceeds the capabilities of the single server.
Shard is nothing more than an Apache Lucene instance - the same Apache Lucene, which Elasticsearch uses to index and process user-defined search requests.
Most recently, on June 13, 2018, an updated version of this Advanced Search Engine service has been released - Elasticsearch 6.3.0 based on Lucene 7.3.0. It is available on the Elastic Cloud. Among the updates, one can mention the enhancement of security and the removal of potential vulnerabilities, support for Java 10, improved functionality, and much more.
And now let's talk about the benefits of using Elasticsearch to add a fuzzy searching system.
- Scalability. As we've explained, you can run Elasticsearch with only one node, and then add more of them - in other words, you have a possibility of scaling the cluster.
- Multitenancy - the ability to organize several different fuzzy search engines within the same Elasticsearch object. It can come in handy for creating multi-language systems and other similar tasks.
- Operational stability. With each data change, several cells of the cluster are logged at once to achieve high fault tolerance. Data will be distributed in such a way that if one of the nodes fails, the information won’t be lost, and the advanced search engine itself will continue to work without interference.
- Real-time indexing. The new data is being indexed without the obvious need to completely rebuild the Elasticsearch index.
- No schema. Elasticsearch provides the opportunity of loading a regular JSON object, which indexes all the information (by itself, as the matter of fact!); also, it includes the data in the search database. It’s really smart and convenient because you don’t have to bother yourself with a data structure (or, at least, there is no need to pay extra attention to the issue) for quick prototyping.
- Configurability. Ease of customization is also an important advantage of Elasticsearch.
- RESTful API. Elasticsearch is almost completely controlled by HTTP using queries in JSON format.
And let's not forget that Elasticsearch is an open-source cloud system. This is, too, a significant benefit to building an effective advanced search engine with its help.
How we used Elasticsearch for e-commerce marketplaces
We've also used Elasticsearch in online marketplace development. We worked on an e-commerce project - a Bookis application that helps users to sell and buy new and “second-hand” books. And, of course, we needed to create an effective and simple search engine.
Our requirements were typical, but still high:
- the ability to search by a large number of criteria (an exact match by one value or by a list of values) and over a wide range
- reducing the load on the server
- the possibility to add information to the index without full reindexing.
- reliability and ease of use
- the economy in implementation and maintenance
Elasticsearch meets all of the above criteria, and so we’ve chosen it.
Elasticsearch in the online marketplace we’ve created allowed us to provide users with an advanced search engine. They just need to enter the author's name or the title of the book to get a list of suitable results sorted by groups: New, Popular, Rating, Price, A-Z, and so on.
So, if you already have an online store or a marketplace, we suggest analyzing its data search engine. Are you sure that it fully meets the needs of your user and that the potential client won’t leave your resource without getting the desired result on his request?
If you have even the slightest doubt, take the time to improve your site (or application) and offer users a full-fledged advanced search engine. Of course, we'll be happy to help you accomplish this task.
By the way, if you're just planning to start an e-commerce project and calculating future expenses, then we advise you to read our article revealing this issue.