问题描述
以下过程基于 Elasticsearch 7.3
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. Note that this can however use significant memory. Alternatively use a keyword field instead.
日志其实已经说得很清楚了,默认情况下 text 类型的字段 fielddata 被禁用。官方文档在这里。
继续排查日志发现:
Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[.kibana], indicesOptions=IndicesOptions......
是启动 kibana 时报的错。
解决方案
根据文档说明将 [type] 字段 fielddata 设置为 true: