Hi all,
I am trying to use a Top Hit aggregation in my Data table. As i understand it will provide me with the latest value of a metric. So, that is what i want, but i dont want the lastest value of the single metric, but for the multiple-value metric.
Imagine, that i have a car shop, where i store and trying to sell my cars. Every period of time i am indexing the "state" of my shop, which is described by the number (field called balance) of cars of a particular engine power (another field) i have now in my store. I always dived my Balance of cars by Engine Power, they are unique (only those that are in a gson: 50, 70, 100, 150, 200 )
Store index
{
"_index": "store",
"_type": "cars",
"_id": "a323af6a-ee2c-4791-ab18-34e3f18ed92e",
"_version": 1,
"_score": null,
"_source": {
"carKey": {
"id": "a323af6a-ee2c-4791-ab18-34e3f18ed92e",
"datetime": 1511268670386
},
"carState": [
{
"assembly": {
"engine power": 50
},
"balance": 60
},
{
"assembly": {
"engine power": 70
},
"balance": 176
},
{
"assembly": {
"engine power": 100
},
"balance": 40
},
{
"assembly": {
"engine power": 150
},
"balance": 20
},
{
"assembly": {
"engine power": 200
},
"balance": 80
}
]
}
}
I want to get the latest state of my store, so i need a Data Table where i could see the latest car Balance of a particular Engine power (it is changed, because i may sell some cars of this power). It should be smthg like this:
I have tryed to make Data Table visualisation: choose Top Hit aggregation, choose Balance as a field of this aggregation, aggregate with Max and sort on datetime (time of a state snapshot). As a bucket I choose a Term Split Aggregation, with a metric field Engine Power choosing the right order and size. I got the fine representation of my data (like in the excel picture), but the Wrong result. it seemed to be no connections between a bucket and the aggregation, engine power and Balance were not connected at all. it was the one value for all of the Engine Powers or different wrong results (when i was trying to change the config).
Please, provide me the right configuration of the Data Table Visualisation to obtain the appropriate result in my case. It would be wonderfull if you provide pictures to. Thanks.