现象
把 EFK 整个集群搭建完成后, 通过 Kibana 操作界面创建索引 (如图 1), 我创建了 lile-zabbix * 的索引, 显示是创建成功了, 但是只要我在重新刷新一次, 已经创建的索引就 "消失了". 后通过查看 Kibana 与 ES 的日志, 均报错如下
Caused by: java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
图 1:
一, 版本信息
- Elasticsearch-7.4.1
- kibana-7.4.1
- filebeat-7.4.1
二, 解决办法
1, 根据官网的信息, 是对 ES 对应的索引的配置进行修改
2, 因为我的索引是根据日期来的, 所以今天对今天的索引进行了修改, 明天的又得修改; 所以我的是直接对我的模板配置进行修改, 这样只要是我这个模板下的索引, 不管是现有的还是以后新添加的, 都生效
- PUT _template/lile_log #lile_log:Template 名称
- {
- "index_patterns": ["lile*"], # 这里模板模板下的所有索引通用的前缀
- "mappings": {
- "properties": {
- "fielddata-*": {
- "type": "text",
- "fielddata": true
- }
- }
- }
- }
三, 结果
相关网址:
https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html
来源: https://www.cnblogs.com/lemon-le/p/11932145.html