Faceted Navigation

59
Faceted Navigation Elastic filtering with ElasticSearch Ruslan Zavacky Sr. Software Architect @ruslanzavacky [email protected]

Transcript of Faceted Navigation

Faceted Navigation Elastic filtering with

ElasticSearch

Ruslan Zavacky Sr. Software Architect

@ruslanzavacky [email protected]

What is Faceted Navigation?

Meanwhile in Latvia

WUT? That’s simple Filtering

Requirements

Faceted Navigation helps users to browse large sets of products quickly and intuitively.

What we should know about Faceted Navigation?

Facets shown to customer should be relevant to their Search or Navigation needs

Search and Refine Samsung

Too much

and what is this s**t?

Do not show facets, that are not making any changes to the result set

Search and Refine Samsung

Avoid dead end

and zero results

Zero Results, how I even got it?

How ebay handles it

How Amazon handles it

Allow users to review and adjust their filtering options at any stage

The Flamenco Search Interface

Projecthttp://flamenco.berkeley.edu

Our experience

400,000+ Product4,000+ Specifications

20,000+ Specification ValuesBrands, Categories, Prices, Deals, Ratings

Dominate your data

Frontend > Backend Backend > FrontendMore logic on Frontend More logic on Backend

Faster Queries Complicated Queries

Complicated Frontend Complicated Frontend

Hard to Scale Easy to Scale

Smaller Response Size Bigger Response Size

We’ve chosen the right solution

Left solution Right solution

Backend is doing all the heavy work. Building all queries, calculating differences

between initial set of data and filtered.

Frontend is responsible only for drawing and re-drawing facets after change.

Road to Hell non-empty results

Javascript Performance

Internet Explorer

ElasticSearch

We’ve chose it long before Faceted Navigation

And Battle Tested it

Then we’ve realised that we can squeeze a lot from it to achieve our business goals

We use ElasticSearch for Storing Data

Analytics Full-Text Searching

and Faceted Navigation

REST

Aggregations =

GROUP BY on steroids

Stats Agg - count, min, max, avg, sum

Terms, Missing, IPv4, Geo Distance, Historgram, Stats, Min, Max, Sum, Percentiles, Cardinality, Geo Bounds, Top Hits, Filter, Filters, Nested, Children, Significant Terms, Range, Date Range, Date Histogram, GeoHash Grid

Terms Agg - count distinct values

Title Bushnell AR Optics 3-9x40 Riflescope

SpecificationsCondition: New, UsedMagnification: 3x, 2x, 1.5xLength: 12.2in, 11.1in, 12.1inReticle: BDC

Brand Bushnell

Categories Riflescopes, Optics

Data Example

Brands, Categories - are simple Terms aggregations

Specifications are the hard partCondition, Magnification, Length, Reticle

We should know product counts with such specifications

To achieve that we’ve separated specifications and specification values into different fields in Product Object

To achieve that we’ve separated specifications and specification values into different fields in Product Object

#1 First query to ElasticSearchReturn products, prepare initial aggregations do not apply any specific filters, except global ones

ResultWe will have all products that match initial criteria (page, limit, orderable) and all facets that selected products have.

#2 Second query to ElasticSearchRun the same query as previous, but add filtered results and make this query to return only aggregations (facets)

ResultYou’ll get filtered aggregations that match your criteria

Merge Query Results Together and

voilà

DEMO TIME

Analytics

More than 1600 hours of Research, Design and Development

More than 80 darts games

X% Conversion

XX:XX average session duration

Thank You!Q&A time