使用变量查询syslog时,发现有些字段就是显示不出值,如下图。
图1
实际上是有值的,如图,
图2
检查发现好几个字段都有同样的问题,如host、message、tags等。
抓包看了一下,就是字段类型问题。
Text fields are not optimised for operations that require per-document field data like aggregations and sorting,
so these operations are disabled by default.
Please use a keyword field instead.
Alternatively, set fielddata=true on [host] in order to load field data by uninverting the inverted index.
Note that this can use significant memory.
图3
解决方法就是改用host.keyword,如下图:
image.png
网友评论