I am working on a dataset it contains application_Id, status of each application and date columns and for each application_Id representing its status as(start,declined,inProgress).
I need to get the latest row of each application_Id based on latest date and time and create a graph showing the number of applications in each status
I've built aggregation-based code for Elasticsearch and i got the expected results, but when I implement it through Vegalite, I'm unable to access the nested fields nor can pass the values to the encoding section (x and y). Kindly provide any assistance on how to pass nested data to the encoding part.
Code:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Event counts from all indexes",
"data": {
"url": {
"%context%": true,
"%timefield%": "@timestamp",
"index": "onemorelasttime",
"body": {
"aggs":{
"by_district":{
"terms": {
"field": "Application ID",
"size": 100
},
"aggs": {
"tops": {
"top_hits": {
"sort": [
{"Time" : {"order" : "desc"}
}],
"size": 1
}
}
}
}
}
"size": 0
}
},
"format": {"property": "aggregations.by_district.buckets"}
},
"mark": "bar",
"encoding": {
"x": {"field": "tops.hits.hits.Status, "type": "nominal", "axis": {"title": false}},
"y": {
"aggregate":count
"field": "tops.hits.hits.Application ID",
"type": "quantitative",
"axis": {"title": "Count of Application ID"}
}
}
}
I also tried with flattend concept but same error stating undefined.