Hey I am trying to understand how this transformation work: Getting duration by using bucket script. Before applying it to my use-case I am trying to know how to get the difference between two sessions in seconds? and the returned value by the example in which unit (months?, days?, seconds?).
and in the example the:
mean we compare both timestamps and we take the lowest value (because of lte) then we assign it to the field max which correspond to the first timestamp (timestamp1) or the second one (timestamp2) of a web session? as timestamp1 < timestamp2.
From what I'm seeing in the documentation, this transform performs to top-level aggregations (one for time_frame.lte, and another for time_frame.gte).
Once that data is collected, a scripted field calculates the duration where params.max (lte as upper limit) > params.min (gte as lower limit). The duration needs to be a positive value.
I believe by default, the result diff is in epoch, but can be converted to millis (using getMillis()).
Thank you @Fenix for your reply, after some test I found that the returned value from:
are in miliseconds, I used an online tool (Calculate Date/Time Difference) to compare the data I have, to get the output in seconds needs only:
"script": "(params.max - params.min)/1000"
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.