Slide 1

Slide 1 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited What’s New in Percolator? @lucacavanna Elasticsearch User Group BeLux

Slide 2

Slide 2 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Agenda

Slide 3

Slide 3 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Agenda What is the percolator? What do people use it for? How does it work? Why did it need a redesign? What was changed exactly?

Slide 4

Slide 4 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Agenda What is the percolator? What do people use it for? How does it work? Why did it need a redesign? What was changed exactly?

Slide 5

Slide 5 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Agenda What is the percolator? What do people use it for? How does it work? Why did it need a redesign? What was changed exactly?

Slide 6

Slide 6 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Agenda What is the percolator? What do people use it for? How does it work? Why did it need a redesign? What was changed exactly?

Slide 7

Slide 7 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Agenda What is the percolator? What do people use it for? How does it work? Why did it need a redesign? What has changed?

Slide 8

Slide 8 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Perco ...what?

Slide 9

Slide 9 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited We are used to docs...

Slide 10

Slide 10 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited PUT /twitter/tweet/1 -d ' { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna", "name": "Luca Cavanna", "date": "2013-10-02", "rt": 5, "loc": { ! "lat": 13.4, ! "lon": 52.5 } } ' We are used to docs...

Slide 11

Slide 11 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited ...and queries

Slide 12

Slide 12 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited ...and queries GET /_search -d ' { "query": { "match": { "tweet": "elasticsearch" } } } '

Slide 13

Slide 13 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s do the opposite

Slide 14

Slide 14 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s index a query...

Slide 15

Slide 15 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited PUT /_percolator/twitter/es-tweets Let’s index a query... verb (index request)

Slide 16

Slide 16 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited PUT /_percolator/twitter/es-tweets Let’s index a query... reserved index

Slide 17

Slide 17 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited PUT /_percolator/twitter/es-tweets Let’s index a query... index to register query against

Slide 18

Slide 18 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited PUT /_percolator/twitter/es-tweets Let’s index a query... query identifier

Slide 19

Slide 19 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s index a query... PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } } } ' the query

Slide 20

Slide 20 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate ...and percolate a doc verb (percolate request)

Slide 21

Slide 21 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate ...and percolate a doc index to percolate against (needs to exist although empty)

Slide 22

Slide 22 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate ...and percolate a doc percolate api endpoint

Slide 23

Slide 23 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate -d ' { “doc”: { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna", "name": "Luca Cavanna", "date": "2013-10-02", "rt": 5, "loc": { ! "lat": 13.4, ! "lon": 52.5 } } } ' ...and percolate a doc document

Slide 24

Slide 24 text

{ "ok": "true", "matches": ["es-tweets"] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited ...and percolate a doc # 200 OK matching queries

Slide 25

Slide 25 text

{ "ok": "true", "matches": ["es-tweets"] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited ...and percolate a doc # 200 OK PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } } } '

Slide 26

Slide 26 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Why would you do that?

Slide 27

Slide 27 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited

Slide 28

Slide 28 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let me know when it’s coming!

Slide 29

Slide 29 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited weather forecast alerts PUT /_percolator/forecast/summer -d ' { "query": { “range”: { “max” : { “gte” : 30 } } } } '

Slide 30

Slide 30 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited weather forecast alerts GET /forecast/type/_percolate -d ' { “doc” : { "date": "2013-07-25", "wind": 1, "min": "22", "max": "32", "rain": 0 } } '

Slide 31

Slide 31 text

{ "ok": "true", "matches": ["summer"] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited # 200 OK weather forecast alerts

Slide 32

Slide 32 text

{ "ok": "true", "matches": ["summer"] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited # 200 OK the summer is coming! weather forecast alerts

Slide 33

Slide 33 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Alerting applies also to:

Slide 34

Slide 34 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Alerting applies also to: Price monitoring News alerts Stock alerts Logs monitoring

Slide 35

Slide 35 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Alerting applies also to: Price monitoring News alerts Stock alerts Logs monitoring

Slide 36

Slide 36 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Alerting applies also to: Price monitoring News alerts Stock alerts Logs monitoring

Slide 37

Slide 37 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Alerting applies also to: Price monitoring News alerts Stock alerts Logs monitoring

Slide 38

Slide 38 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Alerting applies also to: Price monitoring News alerts Stock alerts Logs monitoring ...and many more

Slide 39

Slide 39 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited

Slide 40

Slide 40 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited

Slide 41

Slide 41 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited

Slide 42

Slide 42 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How do I make my ads better?

Slide 43

Slide 43 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Store users queries PUT /_percolator/ads/user1 -d ' { "query": { “match”: { “text” : “iphone subscription”, “operator” : “and” } } } '

Slide 44

Slide 44 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s percolate the ad... GET /ads/apple/_percolate -d ' { “doc” : { "text": "iPhone from 1 euro", "url": “http://www.myads.com/myads” } } '

Slide 45

Slide 45 text

{ "ok": "true", "matches": [] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited # 200 OK No query matches ...and get feedback back

Slide 46

Slide 46 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s modify the ad... GET /ads/apple/_percolate -d ' { “doc” : { "text": “iPhone subscription from 1 euro", "url": “http://www.myads.com/myads” } } '

Slide 47

Slide 47 text

{ "ok": "true", "matches": ["user1"] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited # 200 OK How many people would the updated ad reach? ...and get feedback back

Slide 48

Slide 48 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Enhance documents

Slide 49

Slide 49 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Store articles patterns PUT /_percolator/article/apple -d ' { "query": { “multi_match”: { “fields” : [“title”,”content”], “query” : “ios apple iphone ipad” } } } '

Slide 50

Slide 50 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited percolate a new article GET /article/tech/_percolate -d ' { “doc” : { "title": "iOS 7 released", "content": “iOS 7, the seventh major iteration of the mobile platform, includes more than 200 new features, including a brand new bright and colorful user interface.” } } '

Slide 51

Slide 51 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited percolate a new article { "ok": "true", "matches": ["apple"] } GET /article/tech/_percolate -d ' { “doc” : { "title": "iOS 7 released", "content": “iOS 7, the seventh major iteration of the mobile platform, includes more than 200 new features, including a brand new bright and colorful user interface.” } } '

Slide 52

Slide 52 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited index the enriched article PUT /article/tech/1 -d ' { "title": "iOS 7 released", "content": “iOS 7, the seventh major iteration of the mobile platform, includes more than 200 new features, including a brand new bright and colorful user interface.”, “tag” : “apple” } '

Slide 53

Slide 53 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work?

Slide 54

Slide 54 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /_percolator/_mapping special mapping

Slide 55

Slide 55 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /_percolator/_mapping { "_default_" : { "properties" : { "query" : { "type" : "object", "enabled" : false } } } } special mapping

Slide 56

Slide 56 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /_percolator/_mapping { "_default_" : { "properties" : { "query" : { "type" : "object", "enabled" : false } } } } special mapping queries are only stored

Slide 57

Slide 57 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work?

Slide 58

Slide 58 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work? All queries are loaded in memory Each doc is indexed in memory All queries get executed against it Execution time linear (# of queries) The memory index gets cleaned up

Slide 59

Slide 59 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work? All queries are loaded in memory Each doc is indexed in memory All queries get executed against it Execution time linear (# of queries) The memory index gets cleaned up

Slide 60

Slide 60 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work? All queries are loaded in memory Each doc is indexed in memory All queries get executed against it Execution time linear (# of queries) The memory index gets cleaned up

Slide 61

Slide 61 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work? All queries are loaded in memory Each doc is indexed in memory All queries get executed against it Execution time linear to # of queries The memory index gets cleaned up

Slide 62

Slide 62 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How does it work? All queries are loaded in memory Each doc is indexed in memory All queries get executed against it Execution time linear to # of queries The memory index gets cleaned up

Slide 63

Slide 63 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Query metadata PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } } } '

Slide 64

Slide 64 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Query metadata PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } }, “user_id”: “lucacavanna” } '

Slide 65

Slide 65 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Query metadata PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } }, “user”: { “name” : “Luca Cavanna”, “nick” : “lucacavanna” } } '

Slide 66

Slide 66 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Retrieve query by id GET /_percolator/twitter/es-tweets

Slide 67

Slide 67 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /_percolator/twitter/es-tweets { "query": { "match": { "tweet": "elasticsearch" } }, “user”: { “name” : “Luca Cavanna”, “nick” : “lucacavanna” } } Retrieve query by id

Slide 68

Slide 68 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate -d ' { “doc” : { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna" }, “query” : { “term” : {“user.nick” : “lucacavanna”} } } ' Drill down

Slide 69

Slide 69 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate -d ' { “doc” : { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna" }, “query” : { “term” : {“user.nick” : “lucacavanna”} } } ' Drill down restricts the # of queries to run

Slide 70

Slide 70 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /_percolator/_settings special settings

Slide 71

Slide 71 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /_percolator/_settings { "_percolator" : { "settings" : { "index.version.created" : "900599", "index.number_of_replicas" : "0", "index.number_of_shards" : "1", "index.auto_expand_replicas" : "0-all" } } } special settings

Slide 72

Slide 72 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Node 1 _percolator 0P

Slide 73

Slide 73 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Node 1 _percolator 0P Node 2 _percolator 0R

Slide 74

Slide 74 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Node 1 _percolator 0P Node 2 _percolator 0R Node 3 _percolator 0R

Slide 75

Slide 75 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Looks pretty cool, doesn’t it?

Slide 76

Slide 76 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited What’s wrong with it then?

Slide 77

Slide 77 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited A single shard doesn’t scale!

Slide 78

Slide 78 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited What has changed in master (1.0)?

Slide 79

Slide 79 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s index a query... PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } } } '

Slide 80

Slide 80 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s index a query... PUT /anyindex/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } } } ' any index can contain queries to percolate against

Slide 81

Slide 81 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Let’s index a query... PUT /anyindex/_percolator/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } } } ' reserved type for queries to percolate against

Slide 82

Slide 82 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited How many shards now?

Slide 83

Slide 83 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited As many as you like!

Slide 84

Slide 84 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited This can actually scale!

Slide 85

Slide 85 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /index1,index2/tweet/_percolate -d ' { “doc”: { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna", "name": "Luca Cavanna", "date": "2013-10-02", "rt": 5, "loc": { ! "lat": 13.4, ! "lon": 52.5 } } } ' Multi-index support

Slide 86

Slide 86 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /alias1/tweet/_percolate -d ' { “doc”: { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna", "name": "Luca Cavanna", "date": "2013-10-02", "rt": 5, "loc": { ! "lat": 13.4, ! "lon": 52.5 } } } ' Full alias support

Slide 87

Slide 87 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Routing support PUT /anyindex/_percolator/id?routing=user1 -d ' { "query": { "match": { "tweet": "elasticsearch" } } } '

Slide 88

Slide 88 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate?routing=user1 -d ' { “doc”: { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna", "name": "Luca Cavanna", "date": "2013-10-02", "rt": 5, "loc": { ! "lat": 13.4, ! "lon": 52.5 } } } Routing support

Slide 89

Slide 89 text

{ "took": 9, “_shards” : { “total” : 5, “successful” : 5, “failed” : 0 }, “count” : 1, "matches": [ { “_index” : “index1”, “_id” : “es-tweets” } ] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited New percolate response

Slide 90

Slide 90 text

{ "took": 9, “_shards” : { “total” : 5, “successful” : 5, “failed” : 0 }, “count” : 1, "matches": [ { “_index” : “index1”, “_id” : “es-tweets” } ] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited New percolate response

Slide 91

Slide 91 text

{ "took": 9, “_shards” : { “total” : 5, “successful” : 5, “failed” : 0 }, “count” : 1, "matches": [ { “_index” : “index1”, “_id” : “es-tweets” } ] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited New percolate response

Slide 92

Slide 92 text

{ "took": 9, “_shards” : { “total” : 5, “successful” : 5, “failed” : 0 }, “count” : 1, "matches": [ { “_index” : “index1”, “_id” : “es-tweets” } ] } Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited New percolate response

Slide 93

Slide 93 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Some brand new features

Slide 94

Slide 94 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/1/_percolate Percolate existing doc

Slide 95

Slide 95 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/1/_percolate Percolate existing doc 1) index that contains the document

Slide 96

Slide 96 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/1/_percolate Percolate existing doc 1) index that contains the document 2) and the queries (_percolator type)

Slide 97

Slide 97 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/1/_percolate Percolate existing doc type & id of the existing doc

Slide 98

Slide 98 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/1/_percolate? percolate_index=my-percolator Percolate existing doc separate index where the queries are

Slide 99

Slide 99 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate/count -d ' { “doc”: { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna", "name": "Luca Cavanna", "date": "2013-10-02", "rt": 5, "loc": { ! "lat": 13.4, ! "lon": 52.5 } } } ' Percolate count api

Slide 100

Slide 100 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Percolate count api { "took": 9, “_shards” : { “total” : 5, “successful” : 5, “failed” : 0 }, “count” : 1 }

Slide 101

Slide 101 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate -d ' { “doc” : { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna" }, “filter” : { “term” : {“user.nick” : “lucacavanna”} } } ' Support for filters

Slide 102

Slide 102 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Highlighting PUT /twitter/_percolator/1 -d ' { "query": { "match": { "tweet": "elasticsearch" } } } '

Slide 103

Slide 103 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Highlighting PUT /twitter/_percolator/1 -d ' { "query": { "match": { "tweet": "elasticsearch" } } } ' PUT /twitter/_percolator/2 -d ' { "query": { "match": { "tweet": "awesome" } } } '

Slide 104

Slide 104 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited GET /twitter/tweet/_percolate -d ' { “doc”: { "tweet": "#elasticsearch is AWESOME" }, “highlight”: { “fields” : { “tweet”:{} } }, “size” : 5 } ' Highlighting

Slide 105

Slide 105 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited { ......... “matches”: [ { “_index” : “twitter”, “_id” : “1”, "tweet": "#elasticsearch is AWESOME" }, { “_index” : “twitter”, “_id” : “2”, "tweet": "#elasticsearch is AWESOME" } ] } ' Highlighting

Slide 106

Slide 106 text

PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } }, “user”: { “name” : “Luca Cavanna”, “nick” : “lucacavanna” } } ' Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Basic scoring

Slide 107

Slide 107 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Basic scoring PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } }, “user”: { “name” : “Luca Cavanna”, “nick” : “lucacavanna” } } ' GET /twitter/tweet/_percolate -d ' { “doc” : { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna" }, “query” : { “match” : {“user.name” : “Luca”} } } '

Slide 108

Slide 108 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Basic scoring PUT /_percolator/twitter/es-tweets -d ' { "query": { "match": { "tweet": "elasticsearch" } }, “user”: { “name” : “Luca Cavanna”, “nick” : “lucacavanna” } } ' GET /twitter/tweet/_percolate -d ' { “doc” : { "tweet": "#elasticsearch is AWESOME", "nick": "@lucacavanna" }, “query” : { “match” : {“user.name” : “Luca”} } } ' How well does it match?

Slide 109

Slide 109 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Sorting Sort by score Only return the score Limit number of results Further improvements

Slide 110

Slide 110 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Sorting Sort by score Only return the score Limit number of results Further improvements

Slide 111

Slide 111 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Sorting Sort by score Only return the score Limit number of matches Further improvements

Slide 112

Slide 112 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Sorting Sort by score Only return the score Limit number of matches Boosting based on metadata

Slide 113

Slide 113 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Sorting Sort by score Only return the score Limit number of matches Boosting based on metadata Further improvements

Slide 114

Slide 114 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Multi percolate GET /_mpercolate

Slide 115

Slide 115 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited Multi percolate GET /_mpercolate {“percolate” : {“index”:”twitter”, “type”:”tweet”} } {“doc”: {“text”:“elasticsearch is AWESOME!”} } {“percolate” : {“index”:”twitter”, “type”:”tweet”, “id”:”id1”} } {} {“count” : {“index”:”twitter”, “type”:”tweet”} } {“doc”: {“text”:“elasticsearch rocks!”} } {“count” : {“index”:”twitter”, “type”:”tweet”, “id”:”id2”} } {}

Slide 116

Slide 116 text

Copyright Elasticsearch 2013. Copying, publishing and/or distributing without written permission is strictly prohibited www.elasticsearch.org