在kibana中的数组内搜索

 13888102467波光_1984 发布于 2022-12-28 18:45

我将我的日志推送到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 个回答
  • 这将是一个简单的field:<search_term>查询,如 -

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

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

    stacktrace_array:*second line*
    

    2022-12-28 18:48 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有