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
ElasticSearch 101
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
John Beynon
November 27, 2012
Programming
3
3.5k
ElasticSearch 101
My ElasticSearch 101 presentation to the Surrey Ruby User Group, Nov 27th 2012.
John Beynon
November 27, 2012
Tweet
Share
More Decks by John Beynon
See All by John Beynon
Heroku - Why, What and How
johnbeynon
2
3.8k
Other Decks in Programming
See All in Programming
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
970
Fluid Templating in TYPO3 14
s2b
0
130
CSC307 Lecture 03
javiergs
PRO
1
490
CSC307 Lecture 08
javiergs
PRO
0
670
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
4
320
CSC307 Lecture 01
javiergs
PRO
0
690
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
ぼくの開発環境2026
yuzneri
0
110
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
0
100
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
110
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
930
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Transcript
ElasticSearch 101 Wednesday, 28 November 12
It’s for... Wednesday, 28 November 12
You know, Search Wednesday, 28 November 12
based on Apache Lucene Wednesday, 28 November 12
JAVA :( Wednesday, 28 November 12
like MongoDB Wednesday, 28 November 12
HTTP + JSON Wednesday, 28 November 12
Document based Wednesday, 28 November 12
Schema Free Wednesday, 28 November 12
$ curl -XPUT http://localhost:9200/twitter/user/kimchy -d '{ "name" : "Shay Banon"
}' $ curl -XPUT http://localhost:9200/twitter/tweet/1 -d '{ "user": "kimchy", "post_date": "2009-11-15T13:12:00", "message": "Trying out elasticsearch, so far so good?" }' $ curl -XPUT http://localhost:9200/twitter/tweet/2 -d '{ "user": "kimchy", "post_date": "2009-11-15T14:12:12", "message": "You know, for Search" }' Wednesday, 28 November 12
Demo Wednesday, 28 November 12
Auto Detects data types Wednesday, 28 November 12
Mappings Wednesday, 28 November 12
$ curl -XPUT http://localhost:9200/twitter $ curl -XPUT http://localhost:9200/twitter/user/_mapping -d '{
"user" : { "properties" : { "name" : { "type" : "string" } } } }' Wednesday, 28 November 12
{ "tweet" : { "properties" : { "user" : {"type"
: "string", "index" : "not_analyzed"}, "message" : {"type" : "string", "null_value" : "na"}, "postDate" : {"type" : "date"}, "priority" : {"type" : "integer"}, "rank" : {"type" : "float"} } } } Wednesday, 28 November 12
getting data out Wednesday, 28 November 12
$ curl -XGET http://localhost:9200/twitter/tweet/ _search?q=user:kimchy $ curl -XGET http://localhost:9200/twitter/tweet/_search -d
'{ "query" : { "term" : { "user": "kimchy" } } }' $ curl -XGET http://localhost:9200/twitter/_search? pretty=true -d '{ "query" : { "range" : { "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:30:00" } } } }' Wednesday, 28 November 12
Multi Tenancy Wednesday, 28 November 12
$ curl -XPUT http://localhost:9200/elasticsearch/tweet/1 -d '{ "post_date": "2009-11-15T14:12:12", "message": "Zug
Zug", "tag": "warcraft" }' $ curl -XPUT http://localhost:9200/kimchy/tweet/1 -d '{ "post_date": "2009-11-15T14:12:12", "message": "Whatyouwant?", "tag": "warcraft" }' $ curl -XGET http://localhost:9200/kimchy,elasticsearch/ tweet/_search?q=tag:warcraft Wednesday, 28 November 12
Settings Wednesday, 28 November 12
$ curl -XPUT http://localhost:9200/elasticsearch/ -d '{ "settings" : { "number_of_shards"
: 2, "number_of_replicas" : 3 } }' Wednesday, 28 November 12
Distributed Wednesday, 28 November 12
Replicas & Shards Wednesday, 28 November 12
AUTOMATIC Wednesday, 28 November 12
Tools Wednesday, 28 November 12
Curl HTTPClient etc Wednesday, 28 November 12
ElasticSearch-Head https:/ /github.com/mobz/elasticsearch-head Wednesday, 28 November 12
DEMO Wednesday, 28 November 12
RDMS + ElasticSearch Wednesday, 28 November 12
Pre Process data Wednesday, 28 November 12
select " pt.code as pt_code, " pt.name as pt_name, "
array_agg(DISTINCT hlt.code) as high_level_term_codes, " array_agg(DISTINCT hlgt.code) as high_level_group_term_codes, " soc.code as soc_code, " lang.name as language, " lang.meddra_version as meddra_version " ... Wednesday, 28 November 12
{ "low_level_term" : { " " " “id” : “10049364_”
" "name" : "Bleeding lips", " "llt_code" : “10049364", " " " "soc_code” : “10017947", " "high_level_term_codes" : [ "123457", " " " " " "932323" " " " ], " " " ... } } Wednesday, 28 November 12
with Ruby? Wednesday, 28 November 12
Tire https:/ /github.com/karmi/tire Wednesday, 28 November 12
DEMO Wednesday, 28 November 12
With ActiveRecord? Wednesday, 28 November 12
class Article < ActiveRecord::Base " include Tire::Model::Search " include Tire::Model::Callbacks
end Wednesday, 28 November 12
DEMO Wednesday, 28 November 12
Resources http:/ /www.elasticsearch.org https:/ /github.com/karmi/tire Wednesday, 28 November 12