Kibana vega plug-in last state of each log

Hello,

I want to show the latest state diagram for my customers. I have the following data

"values":
[
{"customer": "A", "@timestamp": 1527018117012, "state": "red"},
{„customer": "A", "@timestamp": 1523020495093, "state": "green"},
{"customer": "B", "@timestamp": 1523019277575, "state": "green"},
{"customer": "B", "@timestamp": 1523019247575, "state": "red"},
{"customer": "B", "@timestamp": 1523019147575, "state": "green"},
{"customer": "C", "@timestamp": 1523008092998, "state": "green"},
{"customer": "C", "@timestamp": 1523017219635, "state": " yellow"}
]

There should be only one state shown for each customer: the latest state according to the @timestamp. Currently my diagram shows all the states:

the current vega code is as following:

{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"values": [...]

},
"mark": "point",
"encoding": {
"y": {"field": "customer", "type": "nominal"},
"x": {"field": "state", "type": "nominal"}
}
}

How can I make Vega to show not all state of the customers but only the last state on the diagram? (it should be like this:


)

I will check if this is possible with vega (it can do some data transformations on the client side). However better way to handle this would be to return correct data to kibana. If data is retrieved from elasticsearch something like top hit could be used to retrieve just the latest record for each user.

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