一個只有一個分片的索引無擴容因子
-html
routing 大體是指文檔的idapp
一個擁有兩個分片的索引能夠利用第二個節點來存儲數據
-elasticsearch
分裂須要足夠大的空間分佈式
而後根據上面的信息,來進行分片的數量的計算性能
使用模板能夠建立有用的索引
建立索引模板學習
PUT /_template/my_logs 建立一個名爲 my_logs 的模板
{
"template": "logstash-*",
將這個模板應用於全部以 logstash- 爲起始的索引
"order": 1, 這個模板將會覆蓋默認的 logstash 模板,由於默認模板的 order 更低。
"settings": {
"number_of_shards": 1 限制主分片數量爲 1
},
"mappings": {
"default": { 爲全部類型禁用 _all 域
"_all": {
"enabled": false
}
}
},
"aliases": {
"last_3_months": {}
添加這個索引至 last_3_months 別名中。
}
}設計
歸檔舊索引數據
很是舊的索引 能夠經過snapshot-restore API歸檔至長期存儲rest
Elasticsearch 支持多租戶因此每一個用戶能夠在相同的集羣中擁有本身的索引
一個用戶一個索引」對大多數場景均可以知足日誌
對子文檔進行聚合操做code
POST product/_search { "size": 0, "aggs": { "productSource": { "terms": { "field": "productSource" }, "aggs": { "prices": { "children": { "type": "price" }, "aggs": { "minPrice": { "terms": { "field": "minPrice" } } } } } } } }