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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
顧客の要望は2次情報である 〜アンテナを張るFDEの構造論〜
noriakioji
5
1.1k
わたしが知り合いゼロの勉強会に 行けるようになるまで
r5ni4
2
840
AI駆動開発をチームに根付かせる - 「1行も書かない」チームがHarnessを育てた1年 -
kenichirokimura
6
3.4k
Oracle AI Databaseデータベース・サービス: BaseDB/ExaDB-Dの可用性
oracle4engineer
PRO
1
980
AI駆動開発を組織で促すために
lycorptech_jp
PRO
7
8.9k
あなたの知らないバージョン命名規則
sat
PRO
2
870
Claude Teamプランの コスト最適化を考える
rfdnxbro
1
830
Kiro Crew で始める マルチエージェント開発
miu_crescent
PRO
0
210
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.3k
LLMアプリ、 雰囲気で運用してませんか? 〜LLMOpsの現在地〜
taka_aki
1
590
GopherCon @シアトル に行ってきました
logica0419
0
460
DMMブックスのNext.js化を加速させるAI活用 / Migrating DMM Books to Next.js with AI
kentarom
0
230
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
3
480
Writing Fast Ruby
sferik
630
63k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
430
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
310
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
410
Technical Leadership for Architectural Decision Making
baasie
3
540
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
420
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
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!