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
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
110
Git Lint
bkuhlmann
4
770
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
930
Fragment Composition of GraphQL
quramy
13
1.6k
使ってみよう Azure AI Document Intelligence
kosmosebi
2
370
Ruby Function Composition
bkuhlmann
1
340
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
700
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
4
530
2 週間で Twitter Bot を作ってみた
contour_gara
0
800
Documentation for users with AsciiDoc and Antora
ahus1
0
370
Domain-Driven Transformation
hschwentner
2
1.5k
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
920
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
BBQ
matthewcrist
80
8.8k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
The Invisible Side of Design
smashingmag
294
49k
The Cult of Friendly URLs
andyhume
74
5.7k
Docker and Python
trallard
35
2.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
GitHub's CSS Performance
jonrohan
1025
450k
Building a Modern Day E-commerce SEO Strategy
aleyda
22
6.4k
Being A Developer After 40
akosma
67
580k
Producing Creativity
orderedlist
PRO
338
39k
The Cost Of JavaScript in 2023
addyosmani
21
3.9k
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