背景: 日志存放到es中,设置7天自动删除索引,将副本数设置为0,节省磁盘空间 方法一: 1.设置生命管理策略 2.创建索引模板,关联索引 3.查看引用生命周期策略的索引 方法二: "policy": { "phases": { "delete": { "min_age": "7d", "actions": { "delete": {} } } } } } PUT _template/my_template_iolog { "index_patterns": ["iolog_pro*"], "settings": { "number_of_replicas": 0, "index.lifecycle.name": "my_policy" } } PUT _template/my_template_proglog { "index_patterns": [ "proglog_pro*" ], "settings": { "number_of_replicas": 0, "index.lifecycle.name": "my_policy" } } 原创作者: u_13761951 转载于: https://blog.51cto.com/u_13761951/11909494