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 Intro
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kang-min Liu
April 20, 2013
Technology
6
650
Elasticsearch Intro
Brief Elasticsearch introduction on OSDC.tw 2013
Kang-min Liu
April 20, 2013
Tweet
Share
More Decks by Kang-min Liu
See All by Kang-min Liu
Event-driven programming with Perl
gugod
7
1.8k
Introduction to perlbrew
gugod
2
1.9k
Other Decks in Technology
See All in Technology
今こそ学びたいKubernetesネットワーク ~CNIが繋ぐNWとプラットフォームの「フラッと」な対話
logica0419
5
430
【Ubie】AIを活用した広告アセット「爆速」生成事例 | AI_Ops_Community_Vol.2
yoshiki_0316
1
120
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
240
(技術的には)社内システムもOKなブラウザエージェントを作ってみた!
har1101
0
200
20260204_Midosuji_Tech
takuyay0ne
1
160
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
130
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
5.6k
制約が導く迷わない設計 〜 信頼性と運用性を両立するマイナンバー管理システムの実践 〜
bwkw
3
1k
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
610
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
390
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
480
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
50k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
160
The Limits of Empathy - UXLibs8
cassininazir
1
220
sira's awesome portfolio website redesign presentation
elsirapls
0
150
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
230
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
390
Transcript
ELASTICSEARCH መፌհ Kang-min Liu <
[email protected]
> 13年4月20日星期六
ELASTICSEARCH Distributed (Near) Real Time Search Engine RESTful ෩ɼLucene ࠎɼNoSQL
ܥ elasticsearch.org https://github.com/elasticsearch/elasticsearch elasticsearch.com 13年4月20日星期六
໊ࢺሣর Relational DB ElasticSearch database index table type row document
column field schema mapping index (શ෦) SQL query DSL 13年4月20日星期六
CREATE curl -XPOST http://localhost:9200/social/tweet/1 -d '{ content: "େՈ" user_name: "gugod"
}' 13年4月20日星期六
CREATE curl -XPOST http://localhost:9200/social/tweet/1 -d '{ content: "େՈ" user_name: "gugod"
}' 13年4月20日星期六
CREATE curl -XPOST http://localhost:9200/social/tweet/1 -d '{ content: "େՈ" user: {
name: "gugod", id: 385782393, }, tag: ["osdctw", "demo", "moedict"] }' 13年4月20日星期六
CREATE curl -XPOST http://localhost:9200/social/tweet/1 -d '{ content: "େՈ" user_name: "gugod"
}' index type 13年4月20日星期六
READ curl -XGET http://localhost:9200/social/tweet/1 13年4月20日星期六
UPDATE curl -XPUT http://localhost:9200/social/tweet/1 -d '{ content: "େՈ" user_name: "gugod"
}' 13年4月20日星期六
DELETE curl -XDELETE http://localhost:9200/social/tweet/1 13年4月20日星期六
SEARCH $ curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{ "query": { "filtered"
: { "query" : { "query_string" : { "query" : "some query string here" } }, "filter" : { "term" : { "user" : "kimchy" } } } } } ' query DSL 13年4月20日星期六
SEARCH $ curl -XPOST 'http://localhost:9200/twitter/tweet/_search' -d '{ "query": { "term"
: { "user" : "kimchy" } } } ' 13年4月20日星期六
SEARCH $ curl -XGET 'http://localhost:9200/twitter/tweet/_search?q=nihao' 13年4月20日星期六
፺ਘҾ№ݪཧ 13年4月20日星期六
Inverted index ࡧҾ term → id Relevance Scoring Ꮠ 13年4月20日星期六
༌ೖจ݅ Ԇలੑ: ࣭۩Ԇٴల։తੑ࣭ɼҝʮԆలੑʯɻҝେଟᏐۚሱ೭ಛੑɻ Ԇฏ܊Ԧ: ໌Ṅޭత෧ᥒɻ Ԇӹᆹ: Ԇᆹ໋ɼଟҝᰌॕਓᆹత༻ࢺɻ Ԇੑ: ࣭ՄԆҝࡉើతੑ࣭ɼҝʮԆੑʯɻࡐྉࡏഁᆦ೭લɼఄݱ઼ੑᏓܗతఔ ɻԆੑՄ༻፮ྗࢼᱛதత৳ٴᏗ໘ॖදࣔ೭ɻ
Ԇ؇: ԆᬌɺԆޙɻ 13年4月20日星期六
TOKENIZATION Ԇ ల ੑ ࣭ ۩ Ԇ ٴ
ల ։ త ੑ ࣭ ҝ Ԇ ల ੑ ҝ େ ଟ Ꮠ ۚ ሱ ೭ ಛ ੑ Ԇ ฏ ܊ Ԧ ໌ Ṅ ޭ త ෧ ᥒ Ԇ ӹ ᆹ Ԇ ᆹ ໋ ଟ ҝ ᰌ ॕ ਓ ᆹ త ༻ ࢺ Ԇ ੑ ࣭ Մ Ԇ ҝ ࡉ ើ త ੑ ࣭ ҝ Ԇ ੑ ࡐ ྉ ࡏ ഁ ᆦ ೭ લ ఄ ݱ ઼ ੑ Ꮣ ܗ త ఔ Ԇ ੑ Մ ༻ ፮ ྗ ࢼ ᱛ த త ৳ ٴ Ꮧ ໘ ॖ ද ࣔ ೭ Ԇ ؇ Ԇ ᬌ Ԇ ޙ 13年4月20日星期六
TOKENIZATION Ԇలੑ: ࣭ ࣭۩ ۩Ԇ Ԇ ٴ ٴల ల։ ։త
తੑ ੑ࣭ ҝ Ԇల లੑ ҝେ େଟ ଟᏐ Ꮠۚ ۚሱ ሱ೭ ೭ಛ ಛੑ Ԇฏ܊Ԧ: ໌Ṅ Ṅ ޭ ޭత త෧ ෧ᥒ Ԇӹᆹ: Ԇ ᆹ ᆹ໋ ଟҝ ҝᰌ ᰌॕ ॕਓ ਓ ᆹ ᆹత త༻ ༻ࢺ Ԇੑ: ࣭ ࣭Մ ՄԆ Ԇ ҝ ҝࡉ ࡉើ ើత తੑ ੑ࣭ ҝ Ԇੑ ࡐྉ ྉࡏ ࡏ ഁ ഁᆦ ᆦ೭ ೭લ ఄݱ ݱ઼ ઼ੑ ੑᏓ Ꮣܗ ܗత తఔ ఔ Ԇੑ ੑՄ Մ༻ ༻፮ ፮ྗ ྗࢼ ࢼᱛ ᱛத தత త৳ ৳ ٴ ٴᏗ Ꮧ໘ ໘ॖ ॖ ද දࣔ ࣔ೭ Ԇ؇: Ԇᬌ Ԇޙ 13年4月20日星期六
፺ਘɿԆ Ԇలੑ: ࣭ ࣭۩ ۩Ԇ Ԇ ٴ ٴల ల։ ։త
తੑ ੑ࣭ ҝ Ԇల లੑ ҝେ େଟ ଟᏐ Ꮠۚ ۚሱ ሱ೭ ೭ಛ ಛੑ Ԇฏ܊Ԧ: ໌Ṅ Ṅ ޭ ޭత త෧ ෧ᥒ Ԇӹᆹ: Ԇ ᆹ ᆹ໋ ଟҝ ҝᰌ ᰌॕ ॕਓ ਓ ᆹ ᆹత త༻ ༻ࢺ Ԇੑ: ࣭ ࣭Մ ՄԆ Ԇ ҝ ҝࡉ ࡉើ ើత తੑ ੑ࣭ ҝ Ԇੑ ࡐྉ ྉࡏ ࡏ ഁ ഁᆦ ᆦ೭ ೭લ ఄݱ ݱ઼ ઼ੑ ੑᏓ Ꮣܗ ܗత తఔ ఔ Ԇੑ ੑՄ Մ༻ ༻፮ ፮ྗ ྗࢼ ࢼᱛ ᱛத தత త৳ ৳ ٴ ٴᏗ Ꮧ໘ ໘ॖ ॖ ද දࣔ ࣔ೭ Ԇ؇: Ԇᬌ Ԇޙ 13年4月20日星期六
څ Ԇలੑ: ࣭ ࣭۩ ۩Ԇ Ԇ ٴ ٴల ల։ ։త
తੑ ੑ࣭ ҝ Ԇల లੑ ҝେ େଟ ଟᏐ Ꮠۚ ۚሱ ሱ೭ ೭ಛ ಛੑ Ԇฏ܊Ԧ: ໌Ṅ Ṅ ޭ ޭత త෧ ෧ᥒ Ԇӹᆹ: Ԇ ᆹ ᆹ໋ ଟҝ ҝᰌ ᰌॕ ॕਓ ਓ ᆹ ᆹత త༻ ༻ࢺ Ԇੑ: ࣭ ࣭Մ ՄԆ Ԇ ҝ ҝࡉ ࡉើ ើత తੑ ੑ࣭ ҝ Ԇੑ ࡐྉ ྉࡏ ࡏ ഁ ഁᆦ ᆦ೭ ೭લ ఄݱ ݱ઼ ઼ੑ ੑᏓ Ꮣܗ ܗత తఔ ఔ Ԇੑ ੑՄ Մ༻ ༻፮ ፮ྗ ྗࢼ ࢼᱛ ᱛத தత త৳ ৳ ٴ ٴᏗ Ꮧ໘ ໘ॖ ॖ ද දࣔ ࣔ೭ Ԇ؇: Ԇᬌ Ԇޙ 0.5 0.7 0.3 13年4月20日星期六
څ จ݅తࢺᏐʢʣ ࢺࡏจ݅㚎తස ࢺࡏࡧҾ㚎తස ҙࢦఆ 13年4月20日星期六
څ จ݅తࢺᏐʢʣ ࢺࡏจ݅㚎తස ࢺࡏࡧҾ㚎తස ҙࢦఆ 13年4月20日星期六
څ จ݅తࢺᏐʢʣ ࢺࡏจ݅㚎తස ࢺࡏࡧҾ㚎తස ҙࢦఆ 13年4月20日星期六
څ จ݅తࢺᏐʢʣ ࢺࡏจ݅㚎తස ࢺࡏࡧҾ㚎తස ҙࢦఆ 13年4月20日星期六
QUERY 13年4月20日星期六
{ "query": { "term": { "user": "ingy" } } }
TERM 13年4月20日星期六
{ "query": { "text": { "content": "Ṝᒬಹᒬ" } } }
TEXT 13年4月20日星期六
{ "query": { "text": { "content": "Ṝᒬಹᒬ" } } }
TEXT Ṝᒬ ᒬಹ ಹᒬ 13年4月20日星期六
{ "query": { "range" : { "age" : { "from"
: 10, "to" : 20, "include_lower" : true, "include_upper": false, "boost" : 2.0 } } } } RANGE 13年4月20日星期六
{ "query": { "query_string" : { "query" : "Ṝᒬ AND
ಹᒬ OR ዎᒬ" } } } QUERY_STRING 13年4月20日星期六
{ "query": { "wildcard" : { "user" : "ki*y" }
} } WILDCARD 13年4月20日星期六
{ "query": { "more_like_this" : { "like_text" : "Ṝᒬಹᒬ", "min_term_freq"
: 1, "max_query_terms" : 12 } } } MLT(MORE LIKE THIS) 13年4月20日星期六
๖య + ES https://github.com/g0v/esmoe 13年4月20日星期六
จ݅݁ߏ { "heteronyms": [ { "bopomofo": "ㄧㄢˊ ㄓㄢˇ ㄒㄧㄥˋ", "bopomofo2":
"yán jǎn shìng", "definitions": [ { "def": "࣭۩Ԇٴల։తੑ࣭ɼҝʮԆలੑʯɻҝେଟ Ꮠۚሱ೭ಛੑɻ" } ], "pinyin": "yán zhǎn xìng" } ], "title": "Ԇలੑ" }, 13年4月20日星期六
ਖ਼查 # curl http://localhost:9200/moedict/revised/$(uri_escape ፺)'?pretty=1' { "_index" : "moedict", "_type"
: "revised", "_id" : "፺", "_version" : 1, "exists" : true, "_source" : {"non_radical_stroke_count":10,"stroke_count": 13,"heteronyms":[{"bopomofo":"ㄙㄡ","pinyin":"sōu","bopomofo2":"sōu","definitions": [{"quote":["ॻɽრɽఇلɿʮळɼดେ፺ɼᚙᨶፅಮޒݪɻʯ","ᡅᜊࢤҟɽრҰɽޅ ՇঁɿʮቮࣕओਓᏑञ۩ɼগҰऋɼ້፺ෆಘɻʯ"],"def":"ፙਘɺਘٻɻ","type":"ಈ"}, {"example":["ɿʮ፺ʯɻ"],"quote":["ݩɽԦመำɽኈهɽୈࡾຊɽୈೋંɿʮෆߠ፺ࣗ ݾڰҝɼཁ᧯ผਓഁɻʯ"],"def":"ᒾ查、檢 點。","type":"ಈ"}]}],"title":"፺","radical":"ख"} } 13年4月20日星期六
查ʢ༝ٛ查ࢺʣ # curl --silent http://localhost:9200/moedict/revised/_search\ '?fields=&pretty=1&q='$(uri_escape ፙਘ) | grep _id
"_id" : "ਘࠜ", "_id" : "ਘፙ", "_id" : "๚ٻ", "_id" : "୳ᛝ", "_id" : "ਘٻ", "_id" : "ፙਘ", "_id" : "ፙػ။", "_id" : "ࣗፙ", "_id" : "ਘᒜ", "_id" : "୳ࡧ", 13年4月20日星期六
༻ྫ۟查 # curl --silent -XPOST http://localhost:9200/moedict/revised/_search'?pretty’\ -d '{query:{text:{example: "ߚᒭເ" }}}'
{ "took" : 8, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 485, "max_score" : 5.116848, "hits" : [ { "_index" : "moedict", "_type" : "revised", "_id" : "ঞຊ", "_score" : 5.116848, "_source" : {"heteronyms":[{"bopomofo":"ㄔㄠ ㄅㄣ ˇ","pinyin":"chāo běn","bopomofo2":"chāu běn","definitions":[{"link":["ຠҝʮሜຊʯɺʮᭁ ຊʯɻ"],"example":["ɿʮঞຊߚᒭເʯɻ"],"synonyms":"खຊ","def":"खঞతॻ ੶ɻ"}]}],"title":"ঞຊ"} }, { "_index" : "moedict", "_type" : "revised", "_id" : "Ұ໊", "_score" : 4.27241, "_source" : {"heteronyms":[{"bopomofo":"ㄧ ㄇㄧㄥˊ","pinyin":"yī míng","bopomofo2":"yī míng","definitions":[{"quote":["ߚᒭເɽୈ࢛ेീճɿʮԼᤴᦛ೭ೕ 13年4月20日星期六
༻Ҿݴ查 # curl --silent -XPOST http://localhost:9200/moedict/revised/_search'?pretty'\ -d '{query:{text:{quote: "ߚᒭເ"}}}' {
"took" : 18, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 11858, "max_score" : 1.7719736, "hits" : [ { "_index" : "moedict", "_type" : "revised", "_id" : "ݪߘ", "_score" : 1.7719736, "_source" : {"heteronyms":[{"bopomofo":"ㄩㄢˊ ㄍㄠˇ","pinyin":"yuán gǎo","bopomofo2":"yuán gǎu","definitions":[{"synonyms":"ఈߘ,ߘຊ,ॳߘ,ߘ","quote":["ߚᒭເɽୈޒ ճɿʮ㘸ඟɼճ಄໋খᱺऔྃʰߚᒭເʱݪߘိɼᬇᢛሞۄɻʯ"],"def":"࡞࠷ॳతखߘɻ"}]}],"title":"ݪ ߘ"} }, { "_index" : "moedict", "_type" : "revised", "_id" : "Ұ໘೭㐊", "_score" : 1.6941531, "_source" : {"heteronyms":[{"bopomofo":"ㄧ ㄇㄧㄢˋ ㄓ ㄩㄢ 13年4月20日星期六
༻Ի查 # curl --silent -XPOST http://localhost:9200/moedict/revised/ _search'?pretty' -d '{query:{text_phrase:{bopomofo:"ㄏㄨㄣˋ ㄏㄨ
ㄣˋ"}}}' | grep _id "_id" : "䓬䓬", "_id" : "ࠞࠞ", "_id" : "ࠞࠞಱಱ", "_id" : "ᕒᕒ", 13年4月20日星期六
ग़ݱස࠷ߴతԻ # curl --silent -XPOST http://localhost:9200/moedict/revised/_search'?pretty' -d ' { "query"
: { "match_all" : {} }, "facets" : { "bpmf" : { "terms" : { "field" : "bopomofo" } } } }' 13年4月20日星期六
{ "facets" : { "bpmf" : { "_type" : "terms",
"missing" : 1485, "total" : 430736, "other" : 401706, "terms" : [ { "term" : "ㄅㄨˋ", "count" : 5400 }, { "term" : "ㄕˋ", "count" : 4438 }, { "term" : "ㄧˋ", "count" : 3218 }, { "term" : "ㄧ", "count" : 2939 }, { "term" : "ㄖㄣˊ", "count" : 2754 }, { "term" : "ㄓ", "count" : 2625 }, { "term" : "ㄌㄧˋ", "count" : 2580 }, { "term" : "ㄗ", "count" : 2044 }, { "term" : "ㄕˊ", "count" : 1541 }, { "term" : "ㄒㄧㄣ", "count" : 1491 } ] } } 13年4月20日星期六
FACETS 13年4月20日星期六
FACETS Aggregations SELECT SUM(salary) GROUP BY name FROM employee; 13年4月20日星期六
FACETS range term stats geo distance statistical date histogram 13年4月20日星期六
ྫɿཱӃެใ { "speaker" : "ҕһਗ਼ሞ", "content" : "զࡏਪಈখࡾ௨త࣌ީɼଟਓᔒ༗ҙ౸զਅਖ਼త༻ҙɼআྃ ੋҝᙛᗠऔൟᒇਐ㑊ɺ⃧Ճݐઃతػ။೭֎ɼզ࠷ஶ؟رతੋ᤻༝খࡾ௨ိ࠵Խશ ໘తࡾ௨ɼೳ夠ᩋၷ؛᮫ղౚɻኺṜҰݸᴍೖɼፙҰࠣٞᢛେਐߦሣஊɻ",
"issue" : "3109" } { "speaker" : "ཥҕһܚ՚", "content" : "رแׅ֩Ұɺ֩ೋɺ֩ࡾɺ࢛֩త҆શᏐೳఏߴɻ", "issue" : "3867" } 13年4月20日星期六
curl -XPOST http://localhost:9200/lyg0v/interp_body/_search'?pretty=1' -d ' { "query": { "match_all": {}
}, "facets": { "top": { "terms": { "field": "content" } } } }' 13年4月20日星期六
curl -XPOST http://localhost:9200/lyg0v/interp_body/_search'?pretty=1' -d ' { "query": { "match_all": {}
}, "facets": { "top": { "terms": { "field": "speaker" } } } }' 13年4月20日星期六
OPERATION 13年4月20日星期六
CLUSTERING auto-discovery auto-elected master data replication / partition with flexible
shard / replica setting 13年4月20日星期六
13年4月20日星期六
13年4月20日星期六
shard ~ partition replica ~ duplication 13年4月20日星期六
CLUSTERING more shard faster indexing / scaling more replica faster
searching / failover 13年4月20日星期六
13年4月20日星期六
STATS API http://www.elasticsearch.org/guide/reference/api/admin- cluster-nodes-stats/ औಘ֤߲ᏐᎦ จ݅Ꮠɺ፺ਘ࣍Ꮠɺྦྷܭ፺ਘ࣌ᏐɺྦྷܭݐࡧҾ࣌ؒ cluster / primary /
node / index ֤छڃผ JVM CPU/Heap / OS / Thread / transport ༻㐫ଶ 13年4月20日星期六
JVM GC ᅷ 13年4月20日星期六
SEE ALSO Cool, Bonsai Cool - An introduction to ElasticSearch
http://bit.ly/112xtsk The Road to a Distributed Search Engine http://bit.ly/ZqBBUt elasticsearch, Big Data, Search & Analytics http://bit.ly/11tmbyK 13年4月20日星期六
__END__ OKTHXBYE 13年4月20日星期六