简体   繁体   English

通过 Kibana 中的值总和创建饼图

[英]Creating pie chart by sum of values in Kibana

I have an index in Elasticsearch with data that looks like this:我在 Elasticsearch 中有一个索引,其数据如下所示:

    "_source": {
      "segments": [
        {
          "segmentType": "Indirect",
          "segmentCount": 100
        },
        {
          "segmentType": "Direct",
          "segmentCount": 20
        }
      ]
    }

I want to create a pie chart in Kibana where it takes the sum of segment count of each segment type.我想在 Kibana 中创建一个饼图,它需要每个段类型的段数总和。 Currently, I only have the data above.目前,我只有上面的数据。 So the pie chart should be split about: 83% for indirect and about 17% for direct.所以饼图应该分为:83% 的间接和大约 17% 的直接。 However, when I try to create a pie chart it is being split by 50% each.但是,当我尝试创建饼图时,每个饼图都被分割了 50%。 For slice size, I'm doing a sum of segment count and for split slices I'm doing a terms aggregation by the segment count field.对于切片大小,我正在计算段计数的总和,对于分割切片,我正在通过段计数字段进行术语聚合。

How can I achieve the result I want?我怎样才能达到我想要的结果?

Old post but in case someone is still looking.旧帖子,但以防万一有人仍在寻找。

As far as I know it is not possible with the current version of Kibana (7.11) to create a pie chart using "sum of field value" to split slices, which is my understanding of what you were trying to do here.据我所知,当前版本的 Kibana (7.11) 无法使用“字段值总和”来创建饼图来分割切片,这是我对您在此处尝试执行的操作的理解。

In recent kibana versions the "Percentage Bar" visualization seems to be the way to present the percentage split you seek.在最近的 kibana 版本中,“百分比栏”可视化似乎是呈现您寻求的百分比拆分的方式。

There is a related but old post (2017) on the elastic forum discussing 2 workaround options.弹性论坛上有一篇相关但旧的帖子 (2017) 讨论了 2 个解决方法选项。https://discuss.elastic.co/t/simple-pie-chart-question/92749https://discuss.elastic.co/t/simple-pie-chart-question/92749

  1. Ingesting the data (in these case it would be Indirect/Direct) as separate documents to be able to use the available aggregations.将数据(在这些情况下是间接/直接)作为单独的文档摄取,以便能够使用可用的聚合。
  2. Creating an alternate visualization type, though I believe the more recent "Percentage bar" would fit the purpose.创建替代的可视化类型,但我相信最近的“百分比栏”将符合目的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM