This will be a series of posts on how to make Elasticsearch work with Sitecore in an eCommerce scenario. Sitecore has native Lucene and Solr support and extensions from commercial vendors such as Coveo but such luck if you plan on using elasticsearch. Some attempts have been made to build a elasticsearch content search provider but that was for version 7 of sitecore.
Elasticsearch is a great search engine but quite a bit of work needs to be done to configure it to the specific use case of an eCommerce Faceted Search/Navigation scenario regardless of the CMS/Commerce Platform. In this first post we’ll be focusing on installing the Elasticsearch instance. In the following posts we’ll be defining the data mapping, inserting some test data and building a query suitable for Faceted Search/Guided Navigation and finally making Sitecore talk to Elasticsearch.
Introduction to Faceted Search/Navigation
Faceted Search/Navigation, also known as Guided Navigation is a technique which extends the traditional full-text search with a faceted navigation system. It allows the users to refine or narrow down the product search result set using filters based on faceted classification of the product records. The search and navigation user interface is built such that each incremental filtration restricts the filters further and narrows down the results quickly. The user is also shown the count of products in each of the available facet constraints. For example, if the user is searching for a T-Shirts and the T-shirts come in Red, Green, and Blue color. Here Color would be the dimension and the values (Red, Green and Blue) would be facet constraints and the user would be shown how many of the Red (20), Green (12), Blue (10) products are available. Any constraints with 0 items available would be excluded from the UI as it would lead to a zero results page.
The products have dimensions or facets defined on them such as Brand, Color, Size, Categories, Physical Dimensions, Price, etc. A faceted search system classifies each Product along multiple explicit dimensions/facets which enables the search results to be accessed and ordered in multiple ways rather than in a single, pre-determined, taxonomic order. Increasing number of modern eCommerce sites now use the faceted search/navigation pattern and it has become a well understood eCommerce user experience but proper care must be taken during information architecture design of the site to support Faceted Search.
Here is a screenshot from northface.com as an example that uses faceted navigation. The products on the northface site have category, color, size, price, and activity as facets. See the annotations on the screenshots for the facets and the constraints UI as well as the commonly used item count feature. The UI also allows sorting by Relevance, Price, Rating, etc. Also note that the display images for the search results reflect the color facet constraint (Red and Orange). We are going to need to index the product data in a certain way to be able to support this.
Installing Elasticsearch 6.4.2 (windows command line way)
The specific version of elasticsearch we will be installing need version 9. Download and install java from http://download.oracle.com/otn/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jre-9.0.4_windows-x64_bin.exe. Oracle will annoyingly make you signup and login to be able to download this.
- Download the latest elasticsearch version (6.4.2 as of this writing) from https://www.elastic.co/downloads/elasticsearch
- Unblock, Extract and Copy the downloaded files to c:\elasticsearch-6.4.2
- Run the elasticsearch batch file from C:\elasticsearch-6.4.2\bin>elasticsearch.bat
- Check if elasticsearch responds on port 9200 http://localhost:9200/
We’ll be using the DevTools from Kibana to interact with the elasticsearch instance.
- Download from https://www.elastic.co/downloads/kibana
- Unblock, Extract and Copy the downloaded files to C:\kibana-6.4.2-windows-x86_64
- This will take longer to download and extract kibana as it’s a larger download and has lot more files.
- Check if Kibana Responds at http://localhost:5601
Testing the Installtion
- Open kibana from http://localhost:5601 and go to the DevTools sections
- In the left hand pane of the Console area Type “GET /” and hit the green play button to run the query.
- You should see the elasticsearch cluster information returned in the right hand pane.
In the next post we’ll create the index, define the Data Mapping, load some test data and construct a query suitable for our needs.