創(chuàng)建索引模板設(shè)置分片和副本及時間格式問題
一、創(chuàng)建索引模板
PUT _template/event_template_default
{
"index_patterns":[
"event*",
"logs*",
"waring*"
],
"settings":{
"number_of_shards":3,
"number_of_replicas":2
},
"mappings":{
"properties":{
"@timestamp": {
"type": "date",
"format": "epoch_second"
},
"esRevDate": {
"type": "date",
"format": "epoch_second"
}
}
}
}
二、插入測試數(shù)據(jù)
@Test
public void testInsert(){
long time_millis = System.currentTimeMillis();
String timestamp = String.valueOf(time_millis/1000);
long time = Integer.valueOf(timestamp);
String index="logxxxxxxx";
JSONObject json =new JSONObject();
json.put("@timestamp",time);
json.put("esRevDate",time);
json.put("...","...");
......
ESUtil.addData(json, index, null,null);
}
三、查看索引情況(cerebro可視化插件)
查看分片和副本情況
查看字段
四、通kibana查看數(shù)據(jù)
文章來源:http://www.zghlxwxcb.cn/news/detail-566740.html
五、最后補(bǔ)充下kibana設(shè)置時間格式顯示問題
文章來源地址http://www.zghlxwxcb.cn/news/detail-566740.html
到了這里,關(guān)于ES創(chuàng)建索引模板設(shè)置分片和副本數(shù)及時間格式問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!