Kibana创建索引成功,但一直不显示出来(Fielddata is disabled on text fields by default. Set fielddata=true........)

现象

把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