简体   繁体   English

仅获取字段的 ZE83AED3DDF4667DEC0DAAAACB2BB3BE0BZ 的 Kibana 饼图

[英]Kibana pie chart that fetches only a substring of a field

I'm trying to create a pie chart visualization that should take only a part of a field value.我正在尝试创建一个饼图可视化,它应该只占用字段值的一部分。 Here I have a field called "Version" whose values can be in the form "1.2.3.4" .在这里,我有一个名为"Version"的字段,其值可以采用"1.2.3.4"的形式。 Now I want the pie chart to pick only the first two characters of the field value irrespective of the third and fourth character [For example: "1.2.xx"] and display.现在我希望饼图只选择字段值的前两个字符,而不考虑第三个和第四个字符[例如:“1.2.xx”]并显示。

For example: If I have the versions as below: "Version": "1.0.0.0", "Version": "1.0.0.1", "Version": "1.1.0.0", "Version": "2.0.0.0"例如:如果我有以下版本:“版本”:“1.0.0.0”,“版本”:“1.0.0.1”,“版本”:“1.1.0.0”,“版本”:“2.0.0.0”

Then the pie chart must split series into three parts with values as "1.0.xx", "1.1.xx", "2.0.xx", Where "1.0.xx" will occupy 50% of chart as two documents are present["1.0.0.0","1.0.0.1"].然后饼图必须将系列分成三部分,其值为“1.0.xx”、“1.1.xx”、“2.0.xx”,其中“1.0.xx”将占据图表的 50%,因为存在两个文档[” 1.0.0.0","1.0.0.1"]。

By creating a new runtime field, which will remove the 3rd and 4th characters, you can use that field in the Pie chart.通过创建一个新的运行时字段,该字段将删除第 3 和第 4 个字符,您可以在饼图中使用该字段。

This is an example of that runtime field (of type keyword):这是该运行时字段(类型关键字)的示例:

emit(doc['Version'].value.splitOnToken(".")[0] + "." + doc['Version'].value.splitOnToken(".")[1])

Add runtime field to index pattern in kibana 将运行时字段添加到 kibana 中的索引模式

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

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