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
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
浮動小数の比較について
kishikawakatsumi
0
370
TipKitTips
ktcryomm
0
150
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
340
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
100
SourceGeneratorのマーカー属性問題について
htkym
0
140
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
300
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
200
atmaCup #23でAIコーディングを活用した話
ml_bear
4
730
encoding/json/v2のUnmarshalはこう変わった:内部実装で見る設計改善
kurakura0916
0
300
Premier Disciplin for Micro Frontends Multi Version/ Framework Scenarios @OOP 2026, Munic
manfredsteyer
PRO
0
200
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
200
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
160
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
120
The Art of Programming - Codeland 2020
erikaheidi
57
14k
SEO for Brand Visibility & Recognition
aleyda
0
4.3k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
950
It's Worth the Effort
3n
188
29k
Deep Space Network (abreviated)
tonyrice
0
86
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Statistics for Hackers
jakevdp
799
230k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
140
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
190
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