我刚玩elk没几天,今天启动kibana之后执行查询看见elasticsearch报了一个错误
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. Not
e that this can however use significant memory. Alternatively use a keyword field instead.
刚发现这个错误的时候有点迷茫,这什么错误,怎么会报这个错误,怎么解决?
经过漫长的时间终于找到了答案,长话短说就是
Elasticsearch 5.x版本以后,对排序和聚合等操作,用单独的数据结构(fielddata)缓存到内存里了,默认是不开启的,需要单独开启
更详细的解释参考elasticsearch官方文档 fielddata
解决方案:
PUT you_index/_mapping/
{
"properties": {
"you_field": {
"type": "text",
"fielddata": true
}
}
}
执行完Kibana控制台显示下面信息则成功