Kibana 仪表板 - 来自具有相同映射的 2 个索引的源数据
Kibana dashboard - source data from 2 indices with the same mapping
我正在尝试设置 Kibana 仪表板。
在Elasticsearch中,只有一种文档。
我们有两个具有相同映射的索引:
索引 product_1
和 product_2
:
"_index": "product_1",
"_type": "product",
"_id": "3da33451d10f095c4b8cd485133dc23639244538",
"_score": 1,
"_source": {
...
source": { "brand": "","category": "","store": "Store1"}
...
}
"_index": "product_1",
"_type": "product",
"_id": "3da33451d10f095c4b8cd485133dc23639244538",
"_score": 1,
"_source": {
...
source": { "brand": "","category": "","store": "Store2"}
...
}
...
我们已经成功地创建了跟随可视化。
我们需要计算每个字段的产品(文档)总数 store
:
Top 0 source.store Count
Store1 52,517
Store2 31,517
Store3 12,838
...
所以,问题是:我们如何在此处添加来自第二个索引的数据,以获得这样的结果:
Top 0 source.store Count (product_1) Count (product_2)
Store1 52,517 42,517
Store2 31,517 56,517
Store3 12,838 13,890
...
非常感谢。
PS:我们已经设法从 2 个索引收集数据:
["product_1","product_2"]
所以 kibana 源数据,就好像它是一个索引,我们得到以下错误结果:
Top 0 source.store Count (product_1+product_2)
Store1 102,517
Store2 62,517
Store3 24,838
...
我不确定你正在尝试的是否可行。来自 the elastic search index documentation:
The easiest and most familiar layout clones what you would expect from a relational database.
You can (very roughly) think of an index like a database.
MySQL => Databases => Tables => Columns/Rows
Elasticsearch => Indices => Types => Documents with Properties
据我了解,您正试图在单个查询中从两个数据库(索引)获取数据,据我所知,这是不可能的 - 至少是您想要的方式,即分类结果根据指数。
现在您可能(应该)有一个疑问,如果那是完全不可能的,您是如何得到以下结果的?
Top 0 source.store Count (product_1+product_2)
Store1 102,517
Store2 62,517
Store3 24,838
这就是 Kibana 的魅力所在。您可以使用通配符创建 索引模式 。这将查询卡内的每个索引。例如,创建 logstash-* 将查询所有 logstash-[date] 索引并给出您看到的综合结果。在您的情况下,可以通过将索引模式创建为 product_* 来实现。但我认为你不能用它获得索引明智的分类结果(我想这正是你正在寻找的)。
我正在尝试设置 Kibana 仪表板。
在Elasticsearch中,只有一种文档。
我们有两个具有相同映射的索引:
索引 product_1
和 product_2
:
"_index": "product_1",
"_type": "product",
"_id": "3da33451d10f095c4b8cd485133dc23639244538",
"_score": 1,
"_source": {
...
source": { "brand": "","category": "","store": "Store1"}
...
}
"_index": "product_1",
"_type": "product",
"_id": "3da33451d10f095c4b8cd485133dc23639244538",
"_score": 1,
"_source": {
...
source": { "brand": "","category": "","store": "Store2"}
...
}
...
我们已经成功地创建了跟随可视化。
我们需要计算每个字段的产品(文档)总数 store
:
Top 0 source.store Count
Store1 52,517
Store2 31,517
Store3 12,838
...
所以,问题是:我们如何在此处添加来自第二个索引的数据,以获得这样的结果:
Top 0 source.store Count (product_1) Count (product_2)
Store1 52,517 42,517
Store2 31,517 56,517
Store3 12,838 13,890
...
非常感谢。
PS:我们已经设法从 2 个索引收集数据:
["product_1","product_2"]
所以 kibana 源数据,就好像它是一个索引,我们得到以下错误结果:
Top 0 source.store Count (product_1+product_2)
Store1 102,517
Store2 62,517
Store3 24,838
...
我不确定你正在尝试的是否可行。来自 the elastic search index documentation:
The easiest and most familiar layout clones what you would expect from a relational database.
You can (very roughly) think of an index like a database.
MySQL => Databases => Tables => Columns/Rows
Elasticsearch => Indices => Types => Documents with Properties
据我了解,您正试图在单个查询中从两个数据库(索引)获取数据,据我所知,这是不可能的 - 至少是您想要的方式,即分类结果根据指数。
现在您可能(应该)有一个疑问,如果那是完全不可能的,您是如何得到以下结果的?
Top 0 source.store Count (product_1+product_2)
Store1 102,517
Store2 62,517
Store3 24,838
这就是 Kibana 的魅力所在。您可以使用通配符创建 索引模式 。这将查询卡内的每个索引。例如,创建 logstash-* 将查询所有 logstash-[date] 索引并给出您看到的综合结果。在您的情况下,可以通过将索引模式创建为 product_* 来实现。但我认为你不能用它获得索引明智的分类结果(我想这正是你正在寻找的)。