Can we do something like this in vega-lite or any other way in Kibana to display the count and state of the container?
Select count(*), state
from
(
select container_id, state, rank() over (partition by container_id, sort by actionTime desc) as rn
where rn = 1
)
group by state
You will probably need to express this using an Elasticsearch aggregation query, but I can't help you construct the query based on the information you have given here. Have you read the guide to Vega in Kibana?
The most important thing needed to answer your question is:
Sample documents that you have stored in Elasticsearch
A better description of how you want to group documents
so its a real time data stream so as the container state changes, we get a new document with same format, just with new container_state and new actionTime. So I want to calculate the number of containers per state , but I want to eliminate double counting a container in 2 states, so I just need the most recent state of the container.
Okay so here are your options that I would consider using:
The easiest option is to change the document structure so that you can query it better. Elasticsearch has a continuous transforms feature which is often used for this type of transformation.
Without changing the document structure, you will want to combine several aggregations. There are some limits on the maximum size of the response here, but this approach will work for a lot.
Specifically, here are the aggregations that I would use:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.