Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Honza Kral - Explore Your Data with Elasticsearch
Search
NewCircle Training
September 20, 2013
Technology
1.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Honza Kral - Explore Your Data with Elasticsearch
NewCircle Training
September 20, 2013
More Decks by NewCircle Training
See All by NewCircle Training
Spark: A Coding Joyride | QCon SF 2015
newcircle
0
890
Intro to Spark Streaming
newcircle
1
2k
Artisanal Data on the Web: Using JS and Data to Get Literary 21st Century Style
newcircle
0
700
Java 8 Lambda Expressions & Streams
newcircle
0
640
Macros vs Types
newcircle
0
1.3k
Larry Schiefer - Exploring SDK Add-on for Android Devices
newcircle
0
3k
Scala Collections: Why Not? - Paul Phillps
newcircle
2
9.9k
Dave Smith- Mastering the Android Touch System
newcircle
9
17k
Geoff Matrangola- Migrating Your Apps to the New Gradle Build Process
newcircle
1
1.8k
Other Decks in Technology
See All in Technology
巨大気象データと戦う ― サロゲートモデル学習を高速化する圧縮技術
gpuunite_official
0
200
Adding Right-to-Left support to your web application with CSS logical properties — Lessons from Redmine
vividtone
0
160
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
4
26k
20260817_生成AIの動向と中学校・高等学校での活用を考える_v1.00_公開用
doradora09
PRO
0
180
私がブラウザを自作したくなった理由
supurazako
1
280
小粒でもパワフルなJS Runtime Antjsについて
comamoca
0
120
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.5k
AI時代に、人は何を、どう学ぶのか #pbl_pub / What and How Do We Learn in the AI Era?
takaking22
1
200
도구에서 동료까지: 10년차 AI 스타트업의 AI 적응기
inureyes
PRO
1
320
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
英語が話せなくてもKubeConスタッフに参加した話
yusuke427
1
1.1k
同じWAFが、攻撃の“形”は弾く── 正当な“形”の不正は通す
kuroneko13
0
260
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
480
Game over? The fight for quality and originality in the time of robots
wayneb77
1
250
A Modern Web Designer's Workflow
chriscoyier
698
190k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Music & Morning Musume
bryan
47
7.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
エンジニアに許された特別な時間の終わり
watany
108
250k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Transcript
explore your data with elasticsearch Honza Král @honzakral
REST HTTP JSON distributed search analytics real-time scalable open-source Lucene
…
setup # wget elasticsearch.tar.gz # tar xzvf elasticsearch.tar.gz # bin/elasticsearch
# curl localhost:9200
documents # curl -XPUT localhost:9200/stack/question/42 -d '{ “some”: “json” }'
# curl -XGET localhost:9200/stack/question/42 # curl -XDELETE localhost:9200/stack/question/42
search # curl -XGET localhost:9200/_search?q=meetup # curl -XGET localhost:9200/_search -d
'{ “query”: { “query_string”: { “query”: “meetup AND title:python” } } }'
queries & filters # curl -XGET localhost:9200/stack/_search -d '{ “query”:
{ “filtered”: { “query”: { “bool”: { “must”: [ {"multi_match": { "fields": ["title^10", "body"] "query": "python" }}, ], “must_not”: [ {“match”: {“title”: “php”} ] } }, “filter”: { “range”:{"creation_date":{"from":"2013-01-01"}} } } } }'
filter when you can, query if you must
facets # curl -XGET localhost:9200/meetup/_search -d '{ “query”: { ...
}, “facets”: { “monthly_meetups”: { “date_histogram”: { “field”: “event_date”, “interval”: “month” } }, “attendees_per_topic”: { “terms_stats”: { “key_field”: “topic”, “value_script”: “doc['users'].values.length” } } } }'
mix & match curl -XGET http://localhost:9200/dba.stackexchange.com/question/_search -d ' { "query":
{ "custom_score": { "query": { "filtered": { "query": { "bool": { "must": [ {"multi_match": {"fields": ["title^10", "body"], "query": "mysql"}}, { "has_child": { "child_type": "answer", "query": {"match": {"body": "nosql"}} } } ], "must_not": [ {"multi_match": {"fields": ["title", "body"], "query": "nosql"}} ] } }, "filter": { "range": {"creation_date": {"from": "2012-01-01"}} } } }, "script": "(_score + 1) * doc[\"rating\"].value" } }, "fields": ["title", "rating", "creation_date"], "highlight": { "fields": { "title": {"fragment_size" : 50}, "body": {"fragment_size" : 50} } }, "facets": { "tags": { "terms": {"field": "tags"} }, "frequency": { "date_histogram": {"field": "creation_date", "interval": "month"} } } }' Find questions that • Were asked last year • Contain “mysql” in title or body • Don't contain “nosql” • Have answer that has “nosql” in title or body • Include question rating into score calculation • Highlight matches in html • Aggregate over time and tags • ….
Let us pray to the demo gods!
percolator # curl -XPUT localhost:9200/_percolator/stack/meet -d '{ "query" : {
"term" : { "tile" : "meetup" } } }' # curl -XPUT localhost:9200/stack/question/_percolate -d '{ “doc”: { “title”: “SF Python Meetup” } }'
suggester – auto-complete # curl -X POST 'localhost:9200/music/_suggest' -d '{
"song-suggest" : { "text" : "n", "completion" : { "field" : "song_suggest" } } }' { "text" : "Nirvana - Nevermind", "score" : 34.0, "payload" : {"artist_id":2321} }
suggester – did you mean? # curl -XPOST 'localhost:9200/_search' -d
{ "suggest" : { "text" : "Johny Walker", "simple_phrase" : { "phrase" : { ... MAGIC HERE ... "direct_generator" : [ { "field" : "body" } ] } } } }' { "text" : "Johnnie Walker", "score" : 0.314295 }
Is it web scale?
YES!
distributed model
Thanks!