Using X-axis values in queries to determine Y-axis in Kibana

I am trying to visualize duration data on Kibana and my data has both a start-time and an end-time. If I use timelion, I need to get the time value to include data s.t. start-time<=time on x axis<=end-time in the count for that particular time.

Is it possible to do this? I am looking for a non-timelion specific way so that I can use other visualizations if required.

I think what you want is, to actually include the duration (end-time - start-time) into the document. You could either do that by using a scripted field with a scrip like doc['end-time'].value - doc['start-time'].value (and some null checks if those are optional fields. Or an even faster solution, insert that field directly when ingesting that documents into Elasticsearch by let your ingestion pipeline calculate it.

That way you can use the newly "duration" field in any chart you want.


Hey Tim!

I actually want to count all 'active' records at each time.

A record is active iff its start time is < timestamp and end time is > timestamp

Here timestamps will be plotted on the x axis as a time series


this will not be possible outside of timelion, since it would require to work on the same index with different time fields at the same time. I also gave a rather detailed explanation in this forum post that is about pretty much the same problem (even though it's a bit different domain of data).


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