开发更改了日志内容在kibana查看时报错了The length of [xxx] field of [xxx] doc of [xxx] index has exceeded [1000000] - maximum allowed to...
官方文档给出说明
这个报错是因为Elasticsearch默认的最大高亮分析文本长度是1000000。
通过更改“index.highlight.max_analyzed_offset”的允许高亮分析文本的最大长度设置来避免类似于“message”字段长度超过默认最大值的问题
将所有参数设置得太高可能会影响性能,按照索引名去设置高亮查询参数最大值
举例service* 将匹配所有service开头的索引在es节点执行
curl -XPUT "http://127.0.0.1:9200/service*/_settings" -H 'Content-Type: application/json' -d'
{
"index": {
"highlight.max_analyzed_offset": 2147483647
}
}'
查看索引配置的参数service* curl -XGET "http://127.0.0.1:9200/service*/_settings?pretty"
可以看到配置已经添加生效执行过这条命令之后可以返回kibana查看索引恢复正常。
取消配置的高亮查询参数
curl -XPUT "http://127.0.0.1:9200/service*/_settings" -H 'Content-Type: application/json' -d'
{
"index" : {
"highlight.max_analyzed_offset" : null
}
}'
可以看到配置的参数为空了。