Slide 1

Slide 1 text

Rightmove Group Ltd 1st March 2018 @trev_boxmonster Improving Customer Experience with Geo Capabilities at the UK’s Biggest Property Portal Adrian McMichael, Lead Architect

Slide 2

Slide 2 text

Agenda 2 1 History of Elasticsearch at Rightmove 2 Using Geo-search to find documents 3 Using Percolators to alert users 4 Support with the Elastic Stack 5 Bright Ideas

Slide 3

Slide 3 text

Who are Rightmove?

Slide 4

Slide 4 text

4 Tis is a sample image UK’s Largest Property Portal • Established in 2000 • Help users find their next house • Help estate agents and lettings agents advertise their stock • Help agents find vendors • Around 55 million visits a day • 1.2 million properties on site • Over 90% of all estate agents in the UK

Slide 5

Slide 5 text

• Property Search • Sold Price Search and Analysis • Property Alerts • Customer reporting • Supporting our site and applications • On Elasticsearch version 5.6 • 3 cluster types per datacentre for 3 datacentres • Search • Generic • Logging How we use Elasticsearch? 5

Slide 6

Slide 6 text

The Bad ‘Ol Days Rightmove Circa 2014

Slide 7

Slide 7 text

7 Tis is a sample image Fear the unknown! Black Box Search • Old proprietary search software • Master-Slave model that didn’t scale • Had to take cluster offline to re-index • Re-index every night to keep it working • Adding more nodes made it slower • Missing Features • Rolled our own geo-code and caching • Developer fear == No changes

Slide 8

Slide 8 text

8 Tis is a sample image God of the Hunt Enter Project Odin • Investigated new search engine • Solr Vs Elasticsearch • Elasticsearch Wins! • Faster to index • Easier to work with • Had features we wanted • Easier to scale • Introduced Microservices to Rightmove!

Slide 9

Slide 9 text

9 Search Flow

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

Location, Location, Location Using Geo-search to Find Your Next Place

Slide 12

Slide 12 text

12 Tis is a sample image Our use-cases Geo Search at Rightmove • User searches • Map-search • Draw-a-search • Allowing users to draw their own areas • Sold Prices • Where-Can-I-Live • Finding what you can afford

Slide 13

Slide 13 text

• Geo-Distance • Groups results within distance of a central point • Geo-Polygon/Geo-Shape • Polygon/Shape based search for finding results within an area • Geo-Bounding Box • Efficient way of searching within a rectangle Types of Geo-Search 13

Slide 14

Slide 14 text

14 Tis is a sample image Geo Distance • Used for Point based searches • Current Location Search • Allows users to search on the go • Point of interest search • Allows users to search around stations • Sort by distance • Get the closest property to your work or travel • Requires geo_point type on a field • Format is lon,lat in array to match GeoJSON I want to live near this station!

Slide 15

Slide 15 text

15 curl –XGET localhost:9200/property-current/_search –d ‘ { "query":{ "bool":{ "must":{ "match_all":{} }, "filter":{ "geo_distance":{ "distance":”5mi", ”address.location":{ "lat":40, "lon":-70 } } } } } } Geo Distance Search Example

Slide 16

Slide 16 text

16 Tis is a sample image I want to live in this area! Geo Polygon and Geo Shape • Used for Region, City, Outcode and Drawn area searches • Started with Geo-Polygon but moved to Geo-Shape for performance • Simplify Your Polygons • Complex shapes have a hit on performance and are rarely needed. • Sampling techniques can be used to keep shapes simple. • Store your shapes

Slide 17

Slide 17 text

• Geo Polygon searches will only ever include points that fall within the polygon provided but do so at a cost. • Geo Shape searches use a geo-hashing technique that results in Elasticsearch performing text searches. • Paint geo-shapes onto a grid where each square has a co-ordinate. • A shape is translated into these coordinates, or geo-hashes and we look for documents that have hashes that match, essentially doing a text search. • Tune accuracy via setting to correct precision. • Don’t set millimeter accuracy when the points you are searching are the size of a house! • Geo-shapes can’t be used in sorting, scoring or aggregations Geo-Shape Vs Geo-Polygon 17 Performance vs Accuracy

Slide 18

Slide 18 text

18 • Blog post here: https://www.elastic.co/blog/supercharging- geopoint See the video here: https://www.youtube.com/watch?v=l2zB9TD UAL4&feature=youtu.be Breaking polygons down into squares Geo Hashing Example

Slide 19

Slide 19 text

19 curl –XGET localhost:9200/property-current/_search –d ‘ { "query":{ "bool":{ "must":{ "match_all":{} }, "filter":{ "geo_polygon":{ ”address.location":{ "points":[ { "lat":40, "lon":-70 }, {"lat":30, "lon":-80 },{ "lat":20, "lon":-90 } ] } } } }}}’ Requires a geo_point field Geo-Polygon Example

Slide 20

Slide 20 text

20 curl –XGET localhost:9200/pal-location-current/_search –d ‘ { "query":{ "bool":{ "must":{ "match_all":{} }, "filter":{ "geo_shape":{ "geometry":{ "shape":{ "type" : "polygon", "coordinates" : [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }, "relation":"intersects" } } } }}}’ Requires a geo_shape field Geo-Shape Example

Slide 21

Slide 21 text

21 Tis is a sample image I want to browse an area on a map! Bounding Box Search • Fastest form of Geo-search • Does less than and greater than comparison • Uses Top-Left and Bottom-Right coordinates • Compares these to the locations under search using less than or greater than. • Excellent for map-search • The user’s viewport/screen is always a rectangle • Makes searching while panning around a map quick.

Slide 22

Slide 22 text

22 curl –XPUT localhost:9200/property-current/_search –d ‘ { "query":{ "bool":{ "must":{ "match_all":{} }, "filter":{ "geo_bounding_box":{ "pin.location":{ "top_left":{ "lat":40.73, "lon":-74.1}, "bottom_right":{ "lat":40.01, "lon":-71.12} } } } } } } Requires geo_point field Bounding-Box Example

Slide 23

Slide 23 text

23 Tis is a sample image Building Property Search Putting it together • Use Geo Shapes to search within an area • Use Geo Distance searches with a radius when the user searches based on a station or current location or sorting • Be smart with map-searches • When a user zooms or pans within a shape on a map search then use Bounding Box search • Combine viewports with geometry to do partial areas for map search • Don’t Geo search when you don’t have to! • Text search for exact postcode and outcodes on list search

Slide 24

Slide 24 text

Reversing Searches Using Percolators for User Alerts

Slide 25

Slide 25 text

25 Tis is a sample image Property Alerts at Rightmove

Slide 26

Slide 26 text

26 Tis is a sample image Reverse-Searching Percolators • Percolate Queries: • Allow you to index queries • Match documents against the indexed queries instead of the other way around. • Property is matched against the saved searches • We have around 3.5 million saved searches. • 2.5 million Property alert emails a day. • 850,000 locations matched across • Running 1 billion percolate queries a week to create matches for alerts on a cluster of 3 data nodes.

Slide 27

Slide 27 text

27 curl –XPUT localhost:9200/alerts-index –d ‘ { “mappings” : “_doc” : { “properties” : { “features”: { “type” : “text” }, “query”: { “type” : “percolator” } } } }’ Creates an index that can be used for percolate queries Create a percolator index

Slide 28

Slide 28 text

28 curl –XPUT localhost:9200/alerts-index/queries/1 –d ‘ { “query” : “match” : { “features”: “garden” } } }’ Match on messages we want to be notified about Index a Query

Slide 29

Slide 29 text

29 curl –XPUT localhost:9200/alerts-index/_search –d ‘ { "query": { "percolate": { "field":"query", "document_type":"doctype", "document":{ ”features":[”beautiful garden", ”off-street parking"] } } } }’ Find if a message matches the queries we have stored Try to Find a Match

Slide 30

Slide 30 text

• Percolate queries become more expensive as the number of them increases • We mitigate this by filtering down the queries before percolating • Filter by: • Transaction type – e.g. buy or rent • Location Key – Combine location type, id and radius e.g. outcode-1234-0.25 • By only running the percolate query against these candidate indexed queries we know match the same locations or transaction types as the property documents we are comparing we keep each percolate query down to 1000s at most instead of millions. Percolating at scale 30 Searching over millions of queries

Slide 31

Slide 31 text

31 Property Alerts Percolation Architecture

Slide 32

Slide 32 text

32 Example Percolator

Slide 33

Slide 33 text

33 Example Percolator

Slide 34

Slide 34 text

34 Example Percolator

Slide 35

Slide 35 text

Support With the Elastic Stack The effect of the Elastic Stack on Microservice Development support

Slide 36

Slide 36 text

36 Tis is a sample image The challenges Supporting Microservices • 50+ microservices in production • Continuous Deployments instead of 2 weekly releases • Microservices bring us the potential for easier tracing of issues, but only if we get our monitoring right • We generate almost 7.3 Billion log messages a day

Slide 37

Slide 37 text

• Queryable • Keep logs in indices by type not per application. Allows following requests across application boundaries • Flexible • Support dynamic key-values and tags against every log message • Consistent • Promote common log formats using shared logging libraries written to a JSON specification • Easy to configure • We use Git to store Logstash configuration and provide common templates to minimize boilerplate • Separately deployable • Built scripted Jenkins pipelines to deploy log configuration changes Log Collation Requirements 37 Making logging maintainable and useful

Slide 38

Slide 38 text

• Access Log • Logs each incoming request as it completes along with relevant metadata • Client Response Log • Logs outgoing requests from a consuming service to its provider along with the corresponding response time • Error Log • Logs errors with their stack-traces, causes and relevant metadata • App Log • Logs generic application messages useful for cross correlating activity with requests and errors Log Types 38 Using Common Formats across services

Slide 39

Slide 39 text

39 Application Logstash Flow

Slide 40

Slide 40 text

40 Tis is a sample image Looking after microservice Supporting Developers • Provide Elastic Stack Docker Compose stack for development • Wrap up common Logstash/Watcher configuration • Use templates • Wrap Watcher/Alerting with forms • Educate • Elastic Training • Internal Workshops • Evangelise!

Slide 41

Slide 41 text

41

Slide 42

Slide 42 text

42

Slide 43

Slide 43 text

Bright Ideas How Elasticsearch has allowed us to innovate

Slide 44

Slide 44 text

44 Tis is a sample image Where Can I Live? Helping Users Start Their Journey • Users often looking for how to start their property search. • Have a budget or mortgage in principal. • Have a minimum number of bedrooms they need for their family. • Have places they need to be near like work. • We used these factors and Elasticsearch to build a special tool to help these users.

Slide 45

Slide 45 text

DEMO

Slide 46

Slide 46 text

46

Slide 47

Slide 47 text

47

Slide 48

Slide 48 text

48

Slide 49

Slide 49 text

49

Slide 50

Slide 50 text

50 More Questions? Visit us at the AMA

Slide 51

Slide 51 text

www.elastic.co