用kibana可视化

k3fezbri  于 2023-03-21  发布在  Kibana
关注(0)|答案(1)|浏览(256)

我想可视化持续时间的分布。在x轴上,我想1-x毫秒,在y轴上,有多少数据适合它。持续时间是在一个字段中,我在ElasticSearch,但我不能访问它。

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "title": "Duration counts from all indexes",
  "data": {
    "url": {
      "index": "_all",
      "body": {
        "query": {
          "bool": {
            "filter": [
              {"exists": {"field": "duration"}},
              {"query_string": {"query": "duration:*"}}
            ]
          }
        },
        "aggs": {
          "duration_counts": {
            "histogram": {
              "field": "duration",
              "interval": 1 // Use appropriate interval based on your data
            }
          }
        },
        "size": 0
      }
    },
    "format": {"property": "aggregations.duration_counts.buckets"}
  },
  "mark": "bar",
  "encoding": {
    "x": {"field": "key", "type": "quantitative", "axis": {"title": "Duration"}},
    "y": {"field": "doc_count", "type": "quantitative", "axis": {"title": "Document count"}}
  }
}

错误消息为:字段“键”的无限范围:字段“doc_count”的[无限,-无限]和无限范围:[无限,-无限]我该怎么做?
不知道该怎么办

dfddblmv

dfddblmv1#

尝试使用date_histogram而不是histogram进行测试。

"duration_counts": {
        "histogram": {
          "field": "duration",
          "interval": 1 // Use appropriate interval based on your data
        }
      }
    }
"duration_counts": {
        "date_histogram": {
          "field": "duration",
          "calendar_interval": "month" 
        }
      }
    }

相关问题