Kibana:如果数据结果为空,则使用Vega-lite可视化工具

问题描述

我正在尝试使用查询创建vega-lite可视化。但是,如果查询结果返回空,则显示“无法读取属性'xx'未定义”消息。我的可视化代码的某些部分如下:

{
  $schema: https://vega.github.io/schema/vega-lite/v2.6.0.json
  data: {
    name: our_data
    url: {
      index: index-7.0.1-index*
      body: {
        query: {
          bool: {
            filter: [
              {
                match_all: {}
              }
              {
                match_all: {}
              }
            ]
            should: []
            must_not: []
          }
        }
        aggs: {
          xx: {
            top_hits: {
              docvalue_fields: [
                {
                  field: someField
                  format: use_field_mapping
                }
                
              ]
              _source: ["someField"]
              size: 1
              sort: [
                {
                  @timestamp: {order: "desc"}
                }
              ]
            }
          }
        }
      }
    }
    format: {property: "aggregations.xx.hits.hits"}
  }

有什么方法获取“无法读取属性'xx'未定义”消息吗?我只想如果没有数据结果,那么vega-lite可视化看起来空白。

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)