Hi.
I have Vega-lite code for a graph in kibana.
I need to sort my time field in descending order with size 1 in order to get the documents belonging to the latest time.
I know I need to use the following lines, but I don't know how to combine them with the rest of the code:
"body": {
"size": 10000,
"aggs": {
"time_field": {
"terms": {
"field": "Time",
"size": 1,
"order": {
"_key": "desc"
}
},
"aggs": {
"x_Field": {
"terms": {
"field": "x",
"size": 10000
}
}
}
}
}
}
And this is the code I have now:
{
$schema: https://vega.github.io/schema/vega-lite/v2.json
data: {
data: table
url: {
%context%: true
%timefield%: Time
index: data*
body: {
size: 10000
_source: ["X", "Y"]
}
}
format: {property: "hits.hits"}
}
mark: {type: "square", filled: true, size: 800 }
encoding: {
x: {
field: "_source.X"
type: quantitative
axis: {title: "X"}
}
y: {
field: "_source.Y"
type: quantitative
axis: {title: "Y"}
}
}
}