Kibana 在简单的Vega数据表中排序字段(日期)
我有一个简单的文本vega ata表,我们在Kibana中使用它,它工作得很好,但我试图找到一种方法,根据到达日期对结果进行排序,代码如下:Kibana 在简单的Vega数据表中排序字段(日期),kibana,vega,vega-lite,Kibana,Vega,Vega Lite,我有一个简单的文本vega ata表,我们在Kibana中使用它,它工作得很好,但我试图找到一种方法,根据到达日期对结果进行排序,代码如下: { $schema: https://vega.github.io/schema/vega/v3.json config: { title: {offset: 20, fontSize: 14, font: "Helvetica", anchor:"start"} } title: { text: Departure
{
$schema: https://vega.github.io/schema/vega/v3.json
config: {
title: {offset: 20, fontSize: 14, font: "Helvetica", anchor:"start"}
}
title: {
text: Departure Airport Arrival Time
}
background: white
width: 1200
height: 100
padding: {"left": 0, "top": 5, "right": 5, "bottom": 5}
autosize: {type: "pad"}
// Define the data source
data: [
{
name: source
url: {
// change "index" to the name of the index
index: myindex*
"%context%": true
body: {
size: "10"
}
}
format: {property: "hits.hits"}
transform: [
{
type: flatten
// change fields to the actual path for flight segment but keep _source as a prefix
fields: ["_source.Something.FlightSegment"]
as: ["val"]
}
{
type: formula
as: x_position
expr: width * 1 / 4
}
{type: "formula", as: "line_height", expr: "20"}
{
type: stack
groupby: ["x_position"]
field: line_height
as: ["y0", "y1"]
}
]
}
]
marks: [
{
type: text
from: {data: "source"}
interactive: true
encode: {
enter: {
x: {field: "x_position", offset: -250}
y: {field: "y0"}
y2: {field: "y1"}
align: {value: "right"}
text: {field: "val.DepartureAirportCode"}
font: {value: "Helvetica"}
fontSize: {value: 14}
}
}
}
{
type: text
from: {data: "source"}
interactive: true
encode: {
enter: {
x: {field: "x_position", offset: -150}
y: {field: "y0"}
y2: {field: "y1"}
align: {value: "left"}
text: {field: "val.ArrivalDateTime"}
font: {value: "Helvetica"}
fontSize: {value: 14}
}
}
}
]
}
结果如下:
您可以看到结果已返回,但不符合顺序。我想做的是按ArrivalDateTime
订购
我的问题是,我看到的大多数教程都是针对实际图形的,而不仅仅是针对纯文本的
非常感谢在这里帮助我的人。我也对这件事很好奇,所以找到了
尤其是我会做这项工作。我对此也很好奇,所以才发现
特别是将完成这项工作。请确保在中可编辑(所有键都需要引号)。我回答了您的问题,但为了确认这一点,请修复您的json:)@ClemensTolboom,因此在使用Vega的Kibana中,您实际上不像正常的json结构那样使用引号。这很奇怪,我知道,我不知道为什么会这样。上面的问题(除了排序)我的答案有用吗?如果是,请将其标记为答案。关于kibana和vega列表:如果你想让人们很容易地帮助你使其与vega兼容,那会有很大帮助;-)请确保在中是可编辑的(所有键都需要引号)。我回答了您的问题,但为了确认这一点,请修复您的json:)@ClemensTolboom,因此在使用Vega的Kibana中,您实际上不像正常的json结构那样使用引号。这很奇怪,我知道,我不知道为什么会这样。上面的问题(除了排序)我的答案有用吗?如果是,请将其标记为答案。关于kibana和vega列表:如果你想让人们很容易地帮助你使其与vega兼容,那会有很大帮助;-)