Calculate of time in kibana


#1

Hello,

I am learning kibana but i would like to know how to perform the subtraction. For example, we have two fields "starting = 2018-05-15 12:20:03.400779 , ending=2018-05-15 12:20:03.360979" . Can please know is there anyway to calculate duration (ending - starting) as a field. i am having hard to implement it as scripted field. Any help would be appreciated.


(Peter Pisljar) #2

Yep, it can be done.
If you have two date fields (time1 and time2) you can write a script like this:
doc['time2'].value - doc['time1'].value

You'll also want to have the scripted field with
type: number
Format: Duration
InputFormat: seconds (if you use the date fields as normal UNIX timestamp)
OutputFormat: Human Readable


#3

Thank you for the reply. when i tried the same thing as you mentioned above , i am getting an error "15 out of 70 shards failed" and kibana is not displaying any results.


(system) #4

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