elasticsearch 簡介
TRANSCRIPT
ElasticsearchIntroduction 簡介Presented by Pei (Pei-Hsun Kao)
IntroductionOutline
1. 什麼是Elasticsearch?
2. 名詞解釋
Elasticsearch是什麼?
“Elasticsearch is a flexible and powerful open source, distributed, real-time search and analyticsengine. …… Through its robust set of APIs and query DSLs, …… Elasticsearch delivers on the near limitless promises of search technology.”
-elasticsearch.org
Open Source, Distributed, RESTfulSearch Engine
Open Source開放原始碼
Elasticsearch是Github上的開源專案
開放原始碼:免費
新一代的搜尋引擎:技術優勢
擁有龐大的活躍社群:持續更新
已被廣泛應用於許多大型網站:穩定
Distributed分散式架構
Distributed為新型態資料庫NoSQL的重要特徵
為了應付大量資料與效能瓶頸
Elasticsearch屬於Document oriented NoSQL Using JSON as document
Schema-free
Elasticsearch的分散式架構具有 Horizontally scalable
Easy replication
JSON
RESTful API易於使用
RESTful是一種架構風格,漸成Web service的主流。
基於HTTP協定,定義資源(URL),並善用HTTP method
有限但多態的動詞+名詞
Elasticsearch API = RESTful http request +JSON body
搜尋語法稱為”Query DSLs”
Search Engine搜尋引擎
Elasticsearch使用Apache Lucene作為核心。是一個成熟且開源的Java資訊檢索程式庫。
Search Engine是NoSQL Database的一個分類。是為了搜尋而誕生的資料庫,通常具有全文檢索,地理搜尋等高階功能。
結合各方優點
“事實上,Elasticsearch沒有哪個部份是革命性的技術創新。全文索檢、分析系統、或分散式資料庫都早就被實現過。其創新在於把這些個別的科技結合起來,成為單一系統。”
- Elasticsearch: The Definitive Guide
Lucenesearch engine
RestfulAPIDistributed
system
快速崛起的Elasticsearch
2013 ~ 2014
“We use Elasticsearch for…pretty much everything”-David Heinemeier Hansson
Aug. 2014
趨勢已經發生
當你在Wikipedia上找資料;當你在StackOverflow上問問題;當你在Github上瀏覽專案;你都在使用同樣的搜尋引擎:Elasticsearch。
認識Elasticsearch
就像學習關聯式資料庫要先學SQL語法…
Elasticsearch不用”SQL”,他有自己的”Query DSLs”。
Elasticsearch定義了許多專有名詞: 跟索引有關的Index, Type(Mapping), Document…
跟架構有關的Cluster, Node…
跟備援有關的Replica….
讓我們來認識這些名詞。
認識Elasticsearch專有名詞
Index:類似RDBMS的Database;儲存Document(JSON)的命名空間。
Type:類似RDBMS的Table;包含Field列表,儲存相似的JSON
Document:類似RDBMS的Row;單筆資料,即JSON。
Field:類似RDBMS的Column;欄位,即JSON中的數值對。
認識Elasticsearch專有名詞
Node:類似RDBMS的伺服器;通常代表實體機器。
Cluster:類似RDBMS的伺服器叢集;由Node組成。
Shard: RDBMS沒有此概念;為Index的分割,可以存放在不同機器上。為Lucene執行搜尋的基本單位。
0 3 1 4 2
Node_0 Node_1 Node_2
ES Cluster
認識Elasticsearch專有名詞
Primary shard:Index可以有一到多個Primary shard,以分
開儲存,設定後不可更改。(預設值=5)
Replica shard:備援機制。Index可以有零到多份Replica,每個Primary shard都有零到多個Replica shard,可隨時更改。(預設值=1)
P0 P3 P1 P4 P2 R0
R3R1 R4R2
Node_0 Node_1 Node_2
DEMO
1. 瀏覽目錄結構
2. 示範透過Port:9200操作Elasticsearch
3. 透過範例認識Query語法
4. 檢視回傳的JSON內容
Q&A
進一步查詢官方文件:www.elasticsearch.org
未來將針對個別主題另外介紹: 安裝注意事項(不同系統)
監控套件介紹
分散式架構原理
佈屬注意事項
搜尋原理與API
分析原理與API
歡迎討論與問答。