I'm trying to use Vega to visualise the results of a query from elasticsearch.
The actual response from elasticsearch will look like what's in the first data entry below, named "es_response". I need to split that response data into two different data, which I named histogram_data
and rule_data
I tried using format: { property: "..." }
to extract the values in each subdata (as shown below), but it's not allowed by the language.
I also tried using various combinations of Transforms to separate that data, but couldn't get any good result.
What's the best way to do that?
Link to the original vega-lite source
"data": [
{
"name": "es_response",
"values": {
"aggregations": {
"histogram": [
{"a": 30, "b": 28},
{"a": 40, "b": 55},
{"a": 50, "b": 43},
{"a": 60, "b": 91},
{"a": 70, "b": 81},
{"a": 80, "b": 53},
{"a": 90, "b": 19},
{"a": 100, "b": 87},
{"a": 110, "b": 52}
],
"percentiles": {
"values": [
{
"key": 50,
"value": 100
}
]
}
}
}
},
{
"name": "histogram_data",
"source": "es_response",
/*
* This doesn't work, but I really wish it did
*/
"format": { "property": "aggregations.histogram"}
},
{
"name": "percentile_data",
"source": "es_response",
/*
* Same here
*/
"format": { "property": "aggregations.percentiles.values"}
}
]
This is a bug in Vega-Lite right now which is tracked at https://github.com/vega/vega-lite/issues/5034.