我将我的日志推送到elasticsearch,它存储了一个典型的文档 -
{ "_index": "logstash-2014.08.11", "_type": "machine", "_id": "2tSlN1P1QQuHUkmoJfkmnQ", "_score": null, "_source": { "category": "critical log with list", "app_name": "attachment", "stacktrace_array": [ "this is the first line", "this is the second line", "this is the third line", "this is the fourth line", ], "@timestamp": "2014-08-11T13:30:51+00:00" }, "sort": [ 1407763851000, 1407763851000 ] }
Kibana使搜索子串变得非常容易.例如,"critical"
在仪表板中搜索将使用critical
任何字符串映射值中的单词获取所有日志.
我如何搜索类似于"second line"
嵌套在我的doc中的数组中的字符串的内容?
这将是一个简单的field:<search_term>
查询,如 -
"query": { "query_string": { "query": "stacktrace_array:*second line*" } ...
因此,在外行人看来,对于Kibana仪表板,请将搜索查询设置为如此 -
stacktrace_array:*second line*