Sitecore Commerce: Elasticsearch driven Faceted Search/Navigation for eCommerce – Part 1

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 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)

Install Java
The specific version of elasticsearch we will be installing need version 9. Download and install java from Oracle will annoyingly make you signup and login to be able to download this.

Install Elasticsearch

  • Download the latest elasticsearch version (6.4.2 as of this writing) from
  • 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/

Install Kibana
We’ll be using the DevTools from Kibana to interact with the elasticsearch instance.

  • Download from
  • 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.
  • C:\kibana-6.4.2-windows-x86_64\bin>kibana.bat
  • 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.

Sitecore Fundamentals: Branch Template

What is a Branch Template?
In Sitecore Branch templates are a way to create content or item hierarchies automatically. With the help of branch templates the Content Editor can create an entire content sub-tree automatically with a single click when inserting a page/item in a Sitecore content tree. They can be thought of as a recipe a Content Editor can rely on to quickly build a frequently used content hierarchy which can save a lot of time especially if the hierarchy is complex.

A branch template contains an item that defines the branch template. This item branch template definition item is based on the /sitecore/templates/System/Branches/Branch template and it can contain zero or more item hierarchies. When a branch template is invoked, the items under the branch template definition item are duplicated at the point of insertion. Sitecore also performs token substitution ($name, $id, $date, $parentname, etc.) on item names and field values at the time of duplication.

Creating a Branch Template

Step 1: Select the /Sitecore/Template/Branches node. Right click and click on Insert and you should see an option create a “New Branch”, “Branch Folder”, “Command Template” or “Insert from template”. We’ll focus on the first two options. The “Branch Folder” option just creates Branch which can be used to keep things organized in a multi-site scenario. The New Branch option is what is used to actually create a branch template.

Step 2: Clicking on the New Branch option in Step 1 will open a dialog box to select the template you want to create a branch template for. After selecting the template click on the Create button.

You should now see a new node bearing the same name as the template you chose with another item under it of the chosen template type. In our our example we chose a Category Page Template so we have Category Page and an item of type Category Page with the $name token which will get replaced at the time of branch template use.

Step 3: Now, using branch template to insert a single item is of very little use. Lets add a couple of items under the $name node to create a simple hierarchy as shown in the figure. We created a folder called Local Assets and a component of type ContentBlock under the Local Assets folder. This hierarchy can be anything you like. Another thing to reemphasize is that you are not limited to a single hierarchy but you can have multiple hierarchies if the scenario needs it.

Using a Branch Template
Now comes the fun part. The content editor doesn’t need to do anything explicit to invoke the branch template aspect. They just need to insert the Category Page as usual but this time the content hierarchy gets created for them automatically.

The newly created hierarchy based on the branch template looks like this: