Elasticsearch 简明教程
Elasticsearch - Heat Maps
热图是一种可视化类型,其中不同色调的颜色代表图表中的不同区域。值可能是连续变化的,因此颜色的细微差别会随着值而变化。它们对于表示连续变化的数据以及离散数据都非常有用。
Heat map is a type of visualization in which different shades of colour represent different areas in the graph. The values may be continuously varying and hence the colour r shades of a colour vary along with the values. They are very useful to represent both the continuously varying data as well as discrete data.
在本章中,我们将使用名为 sample_data_flights 的数据集来构建热图图表。在其中,我们考虑名为航班始发国和目的国的变量并进行计数。
In this chapter we will use the data set named sample_data_flights to build a heatmap chart. In it we consider the variables named origin country and destination country of flights and take a count.
在 Kibana 主屏幕上,我们找到了名为可视化选项,它允许我们从存储在 Elasticsearch 中的索引创建可视化和聚合。我们选择添加一个新的可视化并选择热图作为如下所示的选项:
In Kibana Home screen, we find the option name Visualize which allows us to create visualization and aggregations from the indices stored in Elasticsearch. We choose to add a new visualization and select Heat Map as the option shown below &mimus;

Choose the Metrics
在下一个屏幕中,系统提示我们选择将在创建热图图表中使用的指标。在这里,我们选择计数作为聚合指标的类型。然后,对于 Y 轴中的桶,我们选择按 OriginCountry 字段进行聚合。对于 X 轴,我们选择相同的聚合,但 DestCountry 作为要使用的字段。在两种情况下,我们都将桶的大小选择为 5。
The next screen prompts us for choosing the metrics which will be used in creating the Heat Map Chart. Here we choose the count as the type of aggregation metric. Then for the buckets in Y-Axis, we choose Terms as the aggregation for the field OriginCountry. For the X-Axis, we choose the same aggregation but DestCountry as the field to be used. In both the cases, we choose the size of the bucket as 5.

在运行上面显示的配置后,我们将生成以下热图图表。
On running the above shown configuration, we get the heat map chart generated as follows.

Note - 你必须允许日期范围为今年,以便图表收集一年的数据来生成有效的热图图表。
Note − You have to allow the date range as This Year so that the graph gathers data for a year to produce an effective heat map chart.