在kibana中的数组内搜索

erb*_*dex 4 lucene elasticsearch kibana

我将我的日志推送到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
  ]
}
Run Code Online (Sandbox Code Playgroud)

Kibana使搜索子串变得非常容易.例如,"critical"在仪表板中搜索将使用critical任何字符串映射值中的单词获取所有日志.

我如何搜索类似于"second line"嵌套在我的doc中的数组中的字符串的内容?

Ami*_*mit 5

这将是一个简单的field:<search_term>查询,如 -

  "query": {
    "query_string": {
      "query": "stacktrace_array:*second line*"
    }
    ...
Run Code Online (Sandbox Code Playgroud)

因此,在外行人看来,对于Kibana仪表板,请将搜索查询设置为如此 -

stacktrace_array:*second line*
Run Code Online (Sandbox Code Playgroud)