Faceted classification
A typical scenario, often seen as a navigation bar on the left-hand side of an e-commerce product search website, is the need to characterize the same data across multiple dimensions or facets. This example will show you how to perform these faceting queries from a single aggregation pipeline.
Scenario
You want to provide faceted search capability on your retail website to enable customers to refine their product search by selecting specific characteristics against the product results listed on the web page. It is beneficial to classify the products by different dimensions, where each dimension, or facet, corresponds to a particular field in a product record (e.g., product rating or product price).
Each facet should be broken down into a separate range so that a customer can select a specific sub-range (e.g., 4-5 stars) for a particular facet (e.g., rating). The aggregation pipeline will analyze the products collection by each facet's field (rating...