Convert seconds into minutes after sum aggregation

I have an es index which contains the documents to indicate the time spent in seconds by an user in an activity like the one below

      "UserName" : "User1",
      "Activity" : "Interacting",
      "TimeSpent" : 50

I need to visualize the total time spent by each user in every activity. I am able to create the chart with the sum and term aggregation.

But I have a requirement to show the time spent in minutes instead of seconds (Y- axis). I tried to convert the data before aggregation by using a scripted field. But the data is lost when trying to convert seconds to minutes(50 seconds converted to 0 minutes).

I need to find a way where I can sum all the seconds of time spent and then convert it into minutes. Is there a way I can achieve this ?

use a tsvb visulization in kibana. and do as below. field name will be different for you. but you can divide the number /60 get you minute

another way you can do is to go to index pattern and convert that field to duration and kibana will display accordingly. here is example my cpu_minutes is your TimeSpent


Thanks ! I was able to convert the TimeSpent into minutes with both the options. But I want to show the stacked bar graph with TimeSpent in y axis and username/activity in X axis. I couldn't achieve this with Time Series. The second option was almost closer, but the only issue is that the TimeSpent minutes in Y axis are shown in decimal scale. Is there a way to have it in whole number of minutes ?


you can combine with some tinymath function. I think ceil is what you looking

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