Slide 1

Slide 1 text

elasticsearch

Slide 2

Slide 2 text

Simonas Šerlinskas Software engineer at NFQ [email protected]

Slide 3

Slide 3 text

Distributed Based on Apache Lucene HTTP + JSON Document based Schema free Real time search Advanced features What is elasticsearch?

Slide 4

Slide 4 text

IT’S NOT KEY-VALUE STORE ENGINE

Slide 5

Slide 5 text

You know, for search.

Slide 6

Slide 6 text

They are also using

Slide 7

Slide 7 text

Big changes since v0.25 Now its faster More sorting capabilities Did you mean support Multiple documents in 1 query *And other 30 millions features (that means a lot)

Slide 8

Slide 8 text

Setup and run Cool out of the box ;) Download, extract or install $ bin/elasticsearch -f

Slide 9

Slide 9 text

Shards Splits index into parts By default index has 5 shards Automatically balance data between shards

Slide 10

Slide 10 text

Replication Data shared between nodes Nodes connect automatically

Slide 11

Slide 11 text

Data import Support mapping Other columns in type can be added Support arrays $ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d ' { "tweet" : { "properties" : { "message" : {"type" : "string", "store" : "yes"} } } } '

Slide 12

Slide 12 text

Boost values Each field could have different weight Results will be sorted according match $ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d ' { "tweet" : { "_boost" : {"name" : "my_boost", "null_value" : 3.0} } } '

Slide 13

Slide 13 text

Searching

Slide 14

Slide 14 text

Filter vs query Filters are cached and faster Could be combined Filter is useful for range, max, min, etc.. Query DSL is like AST (abs. syntax tree)

Slide 15

Slide 15 text

Must, should Does what it says Could be combined

Slide 16

Slide 16 text

Analyzers Waxolutionists - The smart blip experience, unopened, only 20$!

Slide 17

Slide 17 text

Advanced search Highlighted results Results and suggestions Results and facets Autocomplete

Slide 18

Slide 18 text

Highlight Automatically sets tags around phrase Highly customizable

Slide 19

Slide 19 text

Suggestions Elasticsearch can predict what you had in mind Lists results by similarity and frequency $ curl -XPOST http://localhost:9200/_suggest -d ’ { "text": "John", "my-suggestion": { "term": { "field": "name" } } } ‘ my-suggestion: [ { text: jonh offset: 0 length: 4 options: [ { text: john score: 0.85 freq: 15 }, { text: jonathan score: 0.75 freq: 5 } ] } ]

Slide 20

Slide 20 text

Facets Results can be grouped and counted Group several columns at once Also get results { "query": { "query_string": { "query": "Jo*" } }, "facets": { "tags": { "terms": { "field": "country" } } } }

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Completion suggest Faster than prefix search Store additional info for inserts curl -X PUT localhost:9200/music/song/_mapping -d '{ "song" : { "properties" : { "name" : { "type" : "string" }, "suggest" : { "type" : "completion", "index_analyzer" : "simple", "search_analyzer" : "simple", "payloads" : true } } } }

Slide 23

Slide 23 text

Literature http://elasticsearch.org http://git.io/esp http://git.io/bigdesk

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

DEMO