More Related Content Similar to ElasticSearch Introduction (20) More from TsungWei Hu (20) ElasticSearch Introduction1. Copyright © Elitegroup Computer Systems. All Rights Reserved Page1
組內報告
Open Source Technologies
for Search Engine
胡崇偉 marr
2014/07/15
雲端時代的資料索引與搜尋
Case Study on ElasticSearch
2. 組內報告 2012/10/30 2
搜尋引擎的角色
常見於整合式大系統裡
用以協助使用者快速存取需要的內容
提供第一線服務的搜尋服務
收集使用者貢獻的資料進行分析功能
EEA 搜尋功能轉往結合 ElasticSearch
CKAN 使用 ElasticSearch
圖書管理系統 Koha 使用 Lucene/Solr
GitHub 使用 ElasticSearch
Netflix 使用 ElasticSearch
3. 組內報告 2012/10/30 3
解決怎樣的問題?
同義詞 (語意) 搜尋
搜尋「媽祖」回傳包括「天上聖母」的資料
依權重分數 (例: 使用者角色) 調整排序結果
依地理資訊搜尋
選定座標中心搜尋特定距離的資料
顯示額外資訊提示使用者需要的資料
即時分析搜尋/社群資料
整合視覺工具呈現統計結果
降低開發/訓練/管理的整體成本
效能延展並提供一致的開發機制 (API, 資料格式)
4. 組內報告 2012/10/30 4
同義詞(語意)搜尋
Analyzer 可視為斷字斷詞工具
Relational Database RDF Data Model ElasticSearch
傳統使用 Keyword 比對,
擴充 Schema / Column /
SQL 來建立關連的同義詞
需事先建立夠完整的知
識體系,再利用
SPARQL 之類的工具
利用Tokenizer, Token
Filter, Character Filter來
建立 Analyzer 進行搜尋
8. 組內報告 2012/10/30 8
同義詞設定語法
{
“index”: {
“analysis”: {
“analyzer”: {
“my_names”: {
“tokenizer”: “whitespace”,
“filter”: [“my_synonym”]
}
},
“filter”: {
“my_synonym”: {
“type”: “synonym”,
“synonyms_path”: “analysis/synonym.txt”
}
}
13. 組內報告 2012/10/30 13
與資料庫進行類比
Mapping 是指可搜尋的範圍,建立 Type與Field
時就會自動產生 Mapping,預設就可搜尋
Document 是巢狀結構,不像 RDBMS 的Row
只是二維表
都可以執行 CRUD 動作
Relational DB ElasticSearch
Database Index
Table Type
Row Document
Column Field
Schema Mapping
Index Everything is Indexed
SQL Query Domain-Specific Language
14. 組內報告 2012/10/30 14
類似產品的比較
Lucene Solr ElasticSearch Zoie
Java 搜尋函
式庫
企業級搜尋
方案
重新設計過的後起
之秀
由 LinkedIn 開
發
著重底層功能 著重實用性 著重易用性 經歷完整測試
和市場驗證
適於自行開發
產品、需要高
效能的場合
適於企業開
發環境
適於低成本的開發
環境
適於快速回應
使用者的應用
場合
16. 組內報告 2012/10/30 16
優勢及應用建議
適合跨系統整合或大量資料的搜尋和索引
Distributed and Scalable Nodes
降低系統應用的學習/溝通成本
Intuitive and Simple: JSON, REST APIs
Interoperation with Non-Java/JVM Languages
降低整體開發成本
Gateway makes Full Backup easier
Work with Cloud Services: Hadoop, S3
19. 組內報告 2012/10/30 19
發展歷史
1997: Lucene Developed by Doug Cutting
2000: Open Source under GPL
2001: Invited to Apache Jakarta
2004: Promoted to Apache TopLevelProject
2006: Solr Joins Lucene
2010: ElasticSearch Released by Shay Banon
2013: Search in Hadoop Platform
20. 組內報告 2012/10/30 20
新增索引範例
curl –XPUT ‘http://localhost:9200/twitter/tweet/1’ –d ‘{
“user”: “marr”,
“post_date”: “2014-06-30T10:12:12”,
“message”: “trying out ElasticSearch”
}’
{
“_index”: “twitter”,
“_type”: “tweet”,
“_id”: “1”,
“_version”: 1,
“created”: true
}
Editor's Notes 這次的分享內容,是資料庫索引和搜尋的通用議題研究,可應用在系統整合或資料分析的場合。
資料索引和搜尋並不是新議題,也不是有了新工具才能做事,但近五、六年來,透過新工具和新方法,讓我們更有效地改善以前不容易處理的問題。
搜尋引擎在整合式的大系統裡,經常扮演第一線的服務角色,把研究成果累積在資料庫之後,除了提供搜尋和分析服務之外,有時候,使用者查詢或使用系統的狀況,也就是log本身,也可以是值得分析的資料。這在 social networking, cloud service, big data 盛行的年代,成為重要的資訊整合來源。
這半年來,一直發現大型系統都有結合 ElasticSearch 之類的服務,像 EEA, CKAN, Koha 等,讓我好奇它到底解決哪些問題,又是怎樣做到的。
為了方便解說,我們把 ElasticSearch 簡稱為 ES
http://www.elasticsearch.org/case-studies 這裡列舉幾個跟日常工作比較相關的問題,說明 ES 能幫忙怎樣的事。
http://www.rdegges.com/easy-fuzzy-text-searching-with-postgresql/
http://code972.com/blog/2013/12/641-why-elasticsearch-refactoring-story-part-3 http://exploringelasticsearch.com/searching_data.html#sec-searching-analysis
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-synonym-tokenfilter.html
https://www.found.no/media/foundation/text-analysis-part-1/Signatures.svg http://www.slideshare.net/Wavyx/elasticsearch-introduction-at-bigdata-meetup #35 Analyzers 有7種
Facet 類似 GroupBy http://www.elasticsearch.org/blog/stop-stopping-stop-words-a-look-at-common-terms-query/ stop words common terms query
https://www.found.no/foundation/text-analysis-part-2/ http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-synonym-tokenfilter.html http://www.slideshare.net/gugod/elasticsearch-19877436 http://houz.tw/
http://gissrv4.sinica.edu.tw/gis/stgis.aspx
http://www.elasticsearch.org/blog/data-visualization-with-elasticsearch-and-protovis LinkedIn data
http://youtu.be/Kqs7UcCJquM?t=39m20s Kibana Screen http://blog.sina.com.cn/s/blog_4f95f1c40100r455.html
http://en.wikipedia.org/wiki/Variant_Chinese_character http://www.elasticsearch.org/
http://okfnlabs.org/facetview/
https://github.com/okfn/facetview/commits/master?page=3 2011/08/22
http://www.slideshare.net/gugod/elasticsearch-19877436
http://www.slideshare.net/fullscreen/claytron/make-plone-search-act-like-google-using-solr http://architects.dzone.com/articles/our-experience-creating-large
http://www.nosqldb.cn/1368777631032.html
http://exploringelasticsearch.com/overview.html
http://www.elasticsearch.org/blog/introducing-snapshot-restore/
CKAN 在 1.8 之後改用 PostgreSQL
https://blog.liip.ch/archive/2013/07/19/on-elasticsearch-performance.html
http://www.quora.com/Why-should-I-NOT-use-ElasticSearch-as-my-primary-datastore https://www.youtube.com/watch?v=P6VqWiXsGIo elasticsearch.yml
http://www.slideshare.net/sematext/battle-of-the-giants-apache-solr-vs-elasticsearch-apachecon prospective search percolator http://solr-vs-elasticsearch.com/ http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-index_.html
https://www.youtube.com/watch?v=UNsDUNWRWzg Quick Tutorial http://centaurus-dev.eea.europa.eu/pam
http://youtu.be/UNsDUNWRWzg?t=4m48s Facets Example
http://tech.pro/tutorial/1142/building-faceted-search-with-postgresql