Open satapsa opened 8 years ago
look at the last example here: https://github.com/NLPchina/elasticsearch-sql/wiki/Script-Fields
Hi Eliranmoyal
I want the difference between the min and the max of the test date. In the example it is dealing with the the date field directly
When I rin the queru separately I am getting a min - "minDate":{"value":1.4416704E12,"value_as_string":"2015-09-08 00:00:00"}}} and max - "maxDate":{"value":1.4418432E12,"value_as_string":"2015-09-10 00:00:00"
So the date difference should be 2
However am not getting the result in the query below.
SELECT min(test_date) as minDate,max(test_date) as maxDate, script('diffInDays','(doc[\'minDate\'].value - doc[\'maxDate\'].value)/3600/24*10000000000) FROM xxx/test_locs
Is there a way around it ?
Thanks for your help in advance.
Is there a datediff function in sql plug in, which can provide the number of days between 2 dates ?