在kibana中的数组内搜索

时间:2014-08-11 14:12:01

标签: 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
  ]
}

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

我如何搜索"second line"之类的内容,这是一个嵌套在我的doc中的数组中的字符串?

1 个答案:

答案 0 :(得分:5)

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

  "query": {
    "query_string": {
      "query": "stacktrace_array:*second line*"
    }
    ...

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

stacktrace_array:*second line*
相关问题