1. 程式人生 > >Kibana建立索引成功,但一直不顯示出來(Fielddata is disabled on text fields by default. Set fielddata=true........)

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

&n