Display timelion aggregation result as single number

Hi,
Hopefully you can help me with this question I have about visualizing timelion calculation result.
Let's say there is a command A that runs and takes certain time to run. Later command B was introduced that does the same thing but faster. For each command I post into elastic search document with duration and command fields. What I want to accomplish is to display amount of time saved by introducing command B, given that A and B will be used in parallel for some time.
It looks like that in order to calculate this I have to do:
(AvgA - AvgB) * CountB
Where
AvgA - is average duration of command A
AvgB - is average duration of command B
CountB - count of home many times command B were ran.

So I came up with this timelion script to calculate it

$A = 'command:"A"',
$B = 'command:"B"',
$ACount = .es(index='index', q=$A, metric=count).aggregate(sum),
$BCount = .es(index='index', q=$B, metric=count).aggregate(sum),
.es(index='index', q=$A, metric=sum:duration).aggregate(sum)
 .divide($ACount)
.subtract(
 .es(index='index', q=$B, metric=sum:duration).aggregate(sum)
 .divide($BCount))
.multiply($BCount)

As a result of this I'm getting graph with steady horizontal line where Y axis represents result of this calculation. What I would want is to show this in form of a number instead. It looks like timelion has .bars() and .points() which will represent it in form of bars or points. It doesn't seem like there is a way to represent this in form of a number.
The other question I have. Is there a way to do this calculation that I'm doing in metric field, so that I can draw graph where X axis will be time and Y axis will be result of this aggregation for the specified aggregation interval. So that, this way I can build cumulative graph for example.

@alexf can you please grab this question?

Thanks,
Bhavya

Hi,

Can you please take a look at this.

Thanks!

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