Date difference scripted field

Hi,

I wanted to find the difference between two fields using scripted fields. Here are the two date fields and their format:

start_time - June 17th 2018, 09:44:46.000
end_time - June 17th 2018, 09:44:49.000

Which will give proc_time.

Here's what I am trying to do in scripted fields:
doc['start_time'].date.millis - doc['end_time'].date.millis But this is returning the processing time which is deducted from epoch time.

For example, if my processing time is 2 seconds, then the output will be epoch time - 2 seconds.
Which is not what I want.

Any help would be appreciated.

What type are you selecting for the scripted field?

This is solved. I used number and duration to find the difference between two time values in seconds.

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