Top Banner
Faceted Navigation Elastic filtering with ElasticSearch Ruslan Zavacky Sr. Software Architect @ruslanzavacky [email protected]
59
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Faceted Navigation

Faceted Navigation Elastic filtering with

ElasticSearch

Ruslan Zavacky Sr. Software Architect

@ruslanzavacky [email protected]

Page 2: Faceted Navigation

What is Faceted Navigation?

Page 3: Faceted Navigation
Page 4: Faceted Navigation
Page 5: Faceted Navigation
Page 6: Faceted Navigation
Page 7: Faceted Navigation
Page 8: Faceted Navigation

Meanwhile in Latvia

Page 9: Faceted Navigation
Page 10: Faceted Navigation
Page 11: Faceted Navigation

WUT? That’s simple Filtering

Page 12: Faceted Navigation

Requirements

Page 13: Faceted Navigation

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

Page 14: Faceted Navigation

What we should know about Faceted Navigation?

Page 15: Faceted Navigation

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

Page 16: Faceted Navigation

Search and Refine Samsung

Page 17: Faceted Navigation

Too much

Page 18: Faceted Navigation

and what is this s**t?

Page 19: Faceted Navigation

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

Page 20: Faceted Navigation

Search and Refine Samsung

Page 21: Faceted Navigation

Avoid dead end

and zero results

Page 22: Faceted Navigation

Zero Results, how I even got it?

Page 23: Faceted Navigation

How ebay handles it

Page 24: Faceted Navigation

How Amazon handles it

Page 25: Faceted Navigation

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

Page 26: Faceted Navigation

The Flamenco Search Interface

Projecthttp://flamenco.berkeley.edu

Page 27: Faceted Navigation

Our experience

Page 28: Faceted Navigation

400,000+ Product4,000+ Specifications

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

Page 29: Faceted Navigation

Dominate your data

Page 30: Faceted Navigation

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

Page 31: Faceted Navigation

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

between initial set of data and filtered.

Page 32: Faceted Navigation

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

Page 33: Faceted Navigation

Road to Hell non-empty results

Page 34: Faceted Navigation

Javascript Performance

Page 35: Faceted Navigation

Internet Explorer

Page 36: Faceted Navigation
Page 37: Faceted Navigation

ElasticSearch

Page 38: Faceted Navigation
Page 39: Faceted Navigation

We’ve chose it long before Faceted Navigation

And Battle Tested it

Page 40: Faceted Navigation

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

Page 41: Faceted Navigation

We use ElasticSearch for Storing Data

Analytics Full-Text Searching

and Faceted Navigation

Page 42: Faceted Navigation

REST

Aggregations =

GROUP BY on steroids

Page 43: Faceted Navigation

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

Page 44: Faceted Navigation

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

Page 45: Faceted Navigation

Brands, Categories - are simple Terms aggregations

Page 46: Faceted Navigation

Specifications are the hard partCondition, Magnification, Length, Reticle

We should know product counts with such specifications

Page 47: Faceted Navigation

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

Page 48: Faceted Navigation

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

Page 49: Faceted Navigation

#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.

Page 50: Faceted Navigation

#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

Page 51: Faceted Navigation

Merge Query Results Together and

voilà

Page 52: Faceted Navigation

DEMO TIME

Page 53: Faceted Navigation

Analytics

Page 54: Faceted Navigation

More than 1600 hours of Research, Design and Development

Page 55: Faceted Navigation

More than 80 darts games

Page 56: Faceted Navigation

X% Conversion

Page 57: Faceted Navigation

XX:XX average session duration

Page 58: Faceted Navigation

Thank You!Q&A time

Page 59: Faceted Navigation