Vega Array to Data Table

Hi there,

Thanks for being on this topic. I hope it will help others

Here is what I'm trying to achieve:
The data source of my data is from elasticsearch and the data format is like that:
[timestamp: data, metric11:number, metric12: number, metric21:number, metric22: number]

metric11 and metric12 are associated: value11(0) is asociated with value12(0)
Same for metric21 and metric22

I'd like to create a table like that, showing only the latest value (last timestamp) and refreshing everytime it updates

metric11 (sorted) | metric 12 || metric 21 (sorted) | metric22
value11(0) | value12(0)|| value21(0) | value22(0)
value11(1) | value12(1)|| value21(1) | value22(1)
value11(2) | value12(2)|| value21(2) | value22(2)

I'm really struggle to understand how I can do that.

Have you already done something similar ? Any idea ?

thx vm for reading and for your help

It might help if you actually showed an example document you have in Elasticsearch.

It sounds like you might be wanting to use the Top Hits aggregation, have you given that a try?

Hi Lukas, thank you very much for responding !
Here is an example of the data (simplified):
{
"_index": "mydata",
"_type": "_doc",
"_id": "-JRJ220BzFM5gRVLQt0q",
"_version": 1,
"_score": null,
"_source": {
"timestamp": 1571342073684,
"name": "sample1",
"metric1": [
{
"rank": 1,
"value1": "0.021934",
"value2": "0.06",
"source": "google"
},]
"metric2": [
{
"rank": 1,
"value1": "0.02193913",
"value2": "0.43918947",
"source": "twitter"
}]
},
"sort": [
1571342073684
]
}

And I'd like to have:
metric1 .................................. | metric2...............................................|
value1 .... | value2 .| source |value1 ........ | value2 ........| source |
0.021934 | 0.06..... | google |0.02193913 | 0.43918947 | twitter |

Or even if the table metric1 and metric2 are separated that would do the job

Top Hits would be to get only the last value, but I don't understand how I can get this result (probably with the flatten transformation).

Does this sample is of any help ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.