ELK(九)ElasticSearch5.XELK(七)ElasticSearch搜索

来源:互联网 发布:魔兽世界有趣的事 知乎 编辑:程序博客网 时间:2024/06/08 03:56
ES5.X优化
1、设置索引的最大字段数
curl -u elastic -XPUT localhost:9200/_cluster/_settings -d '{
    "index.mapping.total_fields.limit": 2000
  }'
  




2、5.X刷盘
index.refresh_interval: 30s


curl -u elastic -XPUT http://localhost:9200/syslog-2017.06.27/_settings -d '{ 
"index": { 
"refresh_interval": "30s"

}' 




3、创建模版,如果按天创建索引,可以在模板里预先创建好,例如syslog-*的索引,设置分片数6、副本1
curl -u elastic -XPUT http://localhost:9200/_template/syslog -d '{


  "template":"syslog-*",
  "settings" : {
    "index.number_of_shards" : 6,
    "number_of_replicas" : 1,
    "index.refresh_interval" : "60s",
"index.mapping.total_fields.limit": 2000
  }
}'


4、查看模板
curl -u elastic -XGET http://localhost:9200/_template/syslog


5、查看索引的设置
curl -u elastic -XGET http://localhost:9200/syslog-2017.06.27/_settings