What has made ElasticSearch such a popular search engine? Let’s discuss some of the reasons why it is so renowned across leading organizations:
- ElasticSearch is distributed, in the sense, the data we store is distributed to different nodes on an ElasticSearch cluster. This distributed feature helps with faster search, faster storage, and faster operations.
- It is scalable, which means there is no limit to the amount of data you can store. You can store as much data as you want by adding as many nodes you need to the ES cluster.
- This RESTful search engine also provides a REST API on top of the Lucene (complex search libraries) and makes it easy for the users to perform operations using simple REST API methods.
- ElasticSearch is used as search & analytics engine for solving various search use cases.
- Elastic is an organization that takes care of adding the contributions, making upgrades, improving. ElasticSearch also comes up with ELK stack (combination of ElasticSearch, Logstash, & Kibana). This ELK stack provides easy log monitoring and visualization tools for the analytic teams to easily track issues and analyze the trends, which makes the ElasticSearch on many organization’s radars.
Here we will see some of the cool features that ElasticSearch offers and why an organization should adopt this awesome search engine.
Below are some of the awesome search capabilities ElasticSearch provides:
- Field collapsing
- Spatial Geo Search
- Query elevation
- Result set scrolling
- Result set highlighting
Faceting is the way of filtering the search. It helps the user to narrow down the search by applying subsequent filters on various categories.
When you try to search for products like cameras in some of the renowned e-commerce websites, you may have noticed various facets on the site, which helps you to filter down the search results by selecting/deselecting various categories.
For example, the below snapshot shows that the price, brand, and condition which are some of the different facets. Customers can apply filters to the facets to narrow down their search results they are looking for.
Autocomplete is a cool feature that we all have utilized when using search engines. When you type in certain keywords, the search engine lists with possible values you may be looking for. With or without user’s consciousness it helps to more easily find the content.
For instance, when you search for a keyword in a search engine, you would have seen it automatically list down the possible search keywords. You will then be able to select the needed search keyword from the list of suggestions.
The below example shows Google listing down the list of suggestions when typing for “seven wonders” keyword. This autocomplete feature, can easily be achieved using ElasticSearch autocomplete feature, which would otherwise require complex coding.
Field collapsing limits the number of search results per category. For example if you are trying to search for cameras and say there are 20 different cameras available in each of the three available brands like Canon, Nikon, and Sony.
If the complete search results for the Canon are displayed first, and then the Nikon search results are displayed, the user would need to scroll through to the bottom of the page to see the Nikon search results. Imagine if the Canon camera had 1500 search results, the user would be better off visiting a different website.
Here is where field collapsing comes to the rescue. When field collapsing is enabled, you will see only certain number of rows for each brand. Then you will have the option to expand/collapse any particular brand to see the results of that particular brand.
In the below image, the user is presented with two search results for each of the brands. The user may click “more” to see more of the search results for a brand, he/she is interested in.
Spatial Geo Search
Spatial Geo search is an ElasticSearch feature that enables searching and sorting based on the location of a property/building.
Let’s take a scenario where you own a chain of restaurants, and you want the customers to be able to search the website and locate the nearest restaurant, from their location. This would require taking the customer location (usually indicated by latitude and longitude) and then calculate the distance between each of the restaurants. Then one would need to sort the distances calculated to find the nearest one.
ElasticSearch provides a geo distance query, wherein we can specify the distance and the user’s coordinates. ES will automatically retrieve the list of restaurants within that distance sorted by nearest one.
Similarly, ES provides a number of other geo queries like GeoDistance range query to find the list of results within a range. For instance, houses available from 5 miles to 40 miles. Geo Bounding box query to find the results within the bounding box (top left and bottom right coordinates are given as input). Geo polygon query to search the results that fall within the polygon of coordinates.
The below image show the ability to search for restaurants using zip code.
To understand the query elevation feature, I ask you to recollect sponsored ad (or) sponsored search results you would have seen in many websites. This is done by query elevation feature, which means these search results are brought to the top of the search results by giving a boost, otherwise would have fallen away from the top search results.
ElasticSearch provides a tool called “query time boosting” to control the relevance of a search result. For example, we can set the boost factor to be 2 for the job posting items from XYZ company (because they’re paid GOLD customers) and set the boost factor as 4 for the job posting items from the ABC company (because they’re paid PLATINUM customers). This will cause the search result to list the ABC company’s job postings first and then XYZ company’s job postings and then follow other company’s job postings (who are utilizing the free service).
The below example shows the top 3 search results as “sponsored” search results, because they are paid customers and then follows the organic search results.
Result Set Scrolling
Think of Result set scrolling, as a CURSOR in traditional data warehousing. This retrieves all the data in a single search request but displays some of the results. It keeps displaying the results as you scroll down through the search results.
The apt example for this would be while searching the google images, it would display a page of search results initially, and as you scroll down the page, you would have seen more and more results keep coming up.
ElasticSearch provides a scroll API which can be used to search the results. We need to specify the timeout option, until what time the search results should be kept alive. If it is set to 1 minute, then it will keep retrieving the search results from the buffer until the timeout expires. If you scroll again, then the timer resets, so it would again keep the search contexts for another 1 minute and so on.
You can experiment yourselves by searching on google images, scroll all the way to the bottom, then you will see the scroll bar on the right will go up, which means it is loading the new images from the stored buffer. It doesn’t make a new search request when you scroll down but instead, brings from the buffer where it has stored. When the timeout expires, it makes another new search request.
Result set highlighting
Result set highlighting is a feature that highlights one or more fields from the search results. The highlighting tool provided by ElasticSearch uses the Lucene plain highlighter, the fast vector highlighter (fvh) or postings highlighter under the hood.
Using the ES highlighting tool you can specify the field name to be highlighted. So whenever the search keyword is available in that field for a specific result, the field will be highlighted.
Though ElasticSearch provides all the above said nicest search features, it is open source, inexpensive, because ES cluster can be built with commodity hardware or can leverage cloud services. ElasticSearch is a must needed search engine for organizations that are planning to improve their search capabilities or organizations that are planning to move from one search platform to another. More and more organizations are adopting and benefiting from ElasticSearch capabilities. Additionally, ES provides a redundant, secure way of storing data, which also takes the data security aspects. There will also be no loss of data since the data will be replicated across the nodes.
So, whether you are planning to create a search platform, or planning to upgrade your existing search platform or need help migrating from your existing to search platform to a new search platform, we have some of the best and brightest ElasticSearch experts around. Intersys has you covered.