ELK Mapping conflict

由filebeat导入的default template导致

检查

先创建个新的索引:

1
PUT /my_index

然后查下是否有default mapping

1
2
3
4
5
6
7
8
GET /my_index
//像这样
{
"mappings": {
"_default_": {}
}
}

比较下和之前数据的mapping有没有冲突

解决方案

首先查看es中存在的模板 /_template, 是否存在名为filebeat,存在就执行

1
DELETE /_template/filebeat

在日志系统中通常直接由es按天生成索引,这样就简单了,直接把使用错误索引的数据删掉重新导入就好了。

但在使用自己的索引时,就需要做重索引,可以尝试通过索引别名的方式切换

起因

在尝试新的日志格式时,启动了其他版本的filebeat并让它直接output到es,忘记设置 template.enabled: false 导致它导入default模板

在第二天生成新索引时发现kibana报warning shards failed,才发现mapping conflict

填完一坑,继续logstash挖坑