弹性搜索聚合查询参数可视化条形图

发布于 2025-01-25 04:31:06 字数 1260 浏览 4 评论 0原文

因此,我想创建一个条形图,以显示X轴中所有动物群的所有“名称”字段及其在y轴(或vice-vices-vice-vice-vice-vice-vice-vice-ival)中的所有动物群体从现在到6个月之前。 查询参数是什么? 似乎也无法在Kibana中看到这一点:“动物组”字段无法选择。

数据结构如下:

"hits" : [
      {
       "_source" : {
           "AnimalGroup":[
             {
                "value": 12,
                "name": cat
              },
             {
                "value": 13,
                "name": dog
             },
           ],
      {
        "_source":{
          "AnimalGroup":[
             {
                "value": 12,
                "name": fish
              },
             {
                "value": 50,
                "name": dog
             },
           ]
        } 
     }
]

映射:

"mappings" : {
      "dynamic_templates" : [ ],
      "properties" : {
        "AnimalGroup" : {
          "properties" : {
            "value" : {
              "type" : "long"
            },
            "name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
}

编辑:添加了数据映射。

So I want to create a bar chart to display all the "name" fields of all the animal groups in the x-axis and its total "value" field in the y-axis(or vice-versa) from now to 6 months before.
What will the query parameter be for this?
Couldn't seem to visualize this in Kibana either: the "AnimalGroup" field wasn't available to select.

The data structure is as follows:

"hits" : [
      {
       "_source" : {
           "AnimalGroup":[
             {
                "value": 12,
                "name": cat
              },
             {
                "value": 13,
                "name": dog
             },
           ],
      {
        "_source":{
          "AnimalGroup":[
             {
                "value": 12,
                "name": fish
              },
             {
                "value": 50,
                "name": dog
             },
           ]
        } 
     }
]

Mapping:

"mappings" : {
      "dynamic_templates" : [ ],
      "properties" : {
        "AnimalGroup" : {
          "properties" : {
            "value" : {
              "type" : "long"
            },
            "name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
}

EDIT: Added the mapping of the data.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生再见 2025-02-01 04:31:06

您需要在y-axis上选择sum汇总,然后选择AnimalGroup.Value作为字段。

您需要在x-axis上选择术语汇总,然后选择AnimalGroup.name.keyword作为字段。

y-axis

”“在此处输入图像描述”

x-axis

“在此处输入映像”

You need to select sum aggregation on Y-axis and select AnimalGroup.value as field.

You need to select Terms aggregation on X-axis and select AnimalGroup.name.keyword as field.

Y-axis

enter image description here

X-axis

enter image description here

Graph

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文