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
Elasticsearch2系
Search
tsuyoshi nakamura
August 31, 2016
Technology
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Elasticsearch2系
Elasticsearch2系で日本語検索を試す
tsuyoshi nakamura
August 31, 2016
More Decks by tsuyoshi nakamura
See All by tsuyoshi nakamura
社内の勉強会で発表した_output_一部抜粋版_.pdf
tsuyoshi
0
500
PHPを少しでも早く_条件はあるよ_.pdf
tsuyoshi
0
87
スタートアップ6年目のレビュー文化.pdf
tsuyoshi
1
2k
PHPを少し深堀るよ.pdf
tsuyoshi
0
400
Reactive_Manifesto.pdf
tsuyoshi
0
90
About_Resilience.pdf
tsuyoshi
1
96
エンジニアの循環ってgood_or_bad_.pdf
tsuyoshi
0
1.3k
スタートアップしてからの失敗の数々
tsuyoshi
0
2.5k
スタートアップエンジニアの役割
tsuyoshi
0
550
Other Decks in Technology
See All in Technology
Mastraエージェント、どのクラウドにデプロイする?
minorun365
PRO
2
150
デジタル・デザイン構想 by Sayaka Ishizuka
y150saya
0
190
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
170
SRE依存からの脱却 運用を開 発チームへ移す、 フルサイ クル開 発体制の実践
joooee0000
0
150
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
350
AWS Blocks を触ってみた/first-tach-aws-blocks
fossamagna
2
140
Claude Code 珍プレー好プレー
shinyasaita
0
180
きのこカンファレンス2026_肩書きを外したとき私は誰か
yamasatimi
1
130
AIエージェントとPhysical AIが拓く製造業の変革(ハノーバーメッセリキャップ)
iotcomjpadmin
0
210
本当の”仕事”を手放せる未来が見えた
mu7889yoon
0
220
product engineering with qa
nealle
0
140
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
170
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Marketing to machines
jonoalderson
1
5.5k
Unsuck your backbone
ammeep
672
58k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
660
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
340
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
270
YesSQL, Process and Tooling at Scale
rocio
174
15k
Transcript
࣮ફElasticsearch(2.1.1) 2016-01-22 ࣾษڧձ Tsuyoshi Nakamura
全文検索エンジンとしては色々な歴史をたどってきました͕ɺࠓશจݕࡧΤϯδ ϯͱ͍͑”Elas'csearch”͕ྑ͍Έ͍ͨͳײ͡ͰɺAWSʹొ
Agenda • Install͔Βconfigઃఆ • Kuromoji • AnalysisϞδϡʔϧ • ओཁϞδϡʔϧ •
Demo • ௐࠪΓ͠
Install ʙ config • JavayumͰinstall • Elasticsearchެࣜͷrepositories͔ΒkeyΛinport. • Yumઃఆͯ͠yum installͰ࠷৽(2.1.1)͕ೖΔ
• ຊޠͷશจݕࡧʹඞཁͳpluginΛinstall Kuromoji plugin install bin/plugin install analysis-kuromoji ※https://www.elastic.co/guide/en/elasticsearch/plugins/master/analysis- kuromoji.html ※https://github.com/elastic/elasticsearch-analysis-kuromoji
Kuromoji • ͷ໊લʢΫϩϞδʁʣʁ༶ࢬͷࠇจࣈʁ • ͔Βͳ͍͚Ͳઈศར • Solr͍ͬͯͨ࣌͡ຊޠ༻ͷࣙॻʢMecabΒChasenΒʣΛࣗͰ ೖΕͯɺɺɺͱ৭ʑͱ໘͚ͩͬͨͨ
AnalysisϞδϡʔϧ Analyzer • ෳઃఆՄೳ • τʔΫφΠζॲཧʢܗଶૉղੳʣ • ϑΟϧλʔॲཧ IndexΛ࡞͢Δ࣌ɺݕࡧ͢Δ࣌͜Μͳॲཧ͕ߦΘΕΔ
AnalysisϞδϡʔϧ Tokenizer • τʔΫφΠζํࣜΛઃఆ • KuromojiΛͬͯτʔΫφΠζ͢Δͱ͔ • ngramࣜʹτʔΫφΠζ͢Δͱ͔ Token Filters
• τʔΫφΠζॲཧޙͷτʔΫϯʹରͯ͠ՃॲཧΛ͢Δ • શ֯ӳࣈΛ֯ʹ͠ɼ֯ΧλΧφΛશ֯ʹ͢ͱ͔ Char Filters • τʔΫφΠζॲཧલͷจࣈʹରͯ͠ՃॲཧΛ͢Δ • ه߸ͩͬͨΓɺʮʑʯͩͬͨΓΛআڈ͢Δ࣌ʹ͏
ओཁϞδϡʔϧ Ngram Tkenizer • N-άϥϜͰτʔΫφΠζɻElasticsearchʹ͋Δ cjk_width Token Filter • ֯શ֯Λ౷Ұ͢ΔϑΟϧλɻElasticsearchʹ͋Δ
Lowercase Token Filter • ӳࣈͷେจࣈখจࣈΛ౷Ұ͢ΔϑΟϧλɻElasticsearchʹ͋Δ Synonym Token Filter • ಉٛޠΛ݁ͼ͚ͭΔϑΟϧλɻElasticsearchʹ͋Δ Stop Token Filter • ҙͷϫʔυΛআڈ͢ΔϑΟϧλɻElasticsearchʹ͋Δ HTML Strip Char Filter • HTMLλάΛআڈ͢ΔϑΟϧλɻElasticsearchʹ͋Δ
ࠓճ࡞ͬͨconfig(elasticsearch.yml) # ---------------------------------- Index ----------------------------------- index : analysis : analyzer
: ja : type : custom tokenizer : ja_tokenizer char_filter : [ html_strip, kuromoji_iteration_mark ] filter : [ lowercase, cjk_width, katakana_stemmer, kuromoji_part_of_speech ] ja_ngram : type : custom tokenizer : ngram_ja_tokenizer char_filter : [html_strip] filter : [ cjk_width, lowercase ] tokenizer : ja_tokenizer : type : kuromoji_tokenizer mode : search user_dictionary : /etc/elasticsearch/userdict_ja.txt ngram_ja_tokenizer : type : nGram min_gram : 2 max_gram : 3 token_chars : [letter, digit] filter : katakana_stemmer : type : kuromoji_stemmer
ࠓճ࡞ͬͨindex mapping { "order": 0, "template": "projects01-*", "settings": { "index":
{ "number_of_shards": "1", "number_of_replicas": "0" } }, "mappings": { "project": { "_source": { "enabled": false }, "_all": { "analyzer": "ja", "enabled": true }, "properties": { "update_time": { "format": "YYYY-MM-dd HH:mm:ss", "type": "date" }, "project_id": { "index": "not_analyzed", "type": "string" }, "detail": { "analyzer": "ja", "type": "string" }, "suggest": { "search_analyzer": "ja", "analyzer": "ja", "type": "completion" }, "detail_ngram": { "analyzer": "ja_ngram", "type": "string" }, "title": { "analyzer": "ja", "type": "string" }, "title_ngram": { "analyzer": "ja_ngram", "type": "string" } } } }, "aliases": { }
Demo
Demo • Elasticsearchͷཧπʔϧ(kopf)ΛݟΔ • ͍Ζ͍Ζػೳ͋Δɻ • Mappingͱ͔͜͜Ͱొͨ͠ • ศརɺ͔͍͍ͬ͜ •
IndexΛ࡞ͬͯΈΔ • ݕࡧͯ͠ΈΔ • αδΣετػೳ(completion)͔ͭͬͯΈΔ
·ͩௐ͕ࠪඞཁͳՕॴ • Indexͷӡ༻ɺߋ৽ϑϩʔ • Pyhon curator • Score • ಉ͡ݕࡧͰݱࡏਐߦ͍ͯ͠ΔPJΛݕࡧ݁Ռͷ্ҐΈ͍ͨͳཁ݅
͕ग़͖ͯͦ͏ • SlowΫΤϦͱ͔ͷᮢ • ES_HEAP_SIZEɺεϫοϓ • clusterɺshardɺreplica • IndexͷόοΫΞοϓɺϦετΞ • Pyhonͷtoolɺ_snapshotɺόΠφϦόοΫΞοϓ • Facet? AggregationsͰ͍͚Δʁ