I want to calculate how many days past with my 'duedate' timestamp.
I guess I need a scripted field but I cannot get it right. Is there a way to this like
doc['today'].value - doc['duedate'].value ?
And it should give 30 (If 30 days passed from the duedate timestamp)
Thanks for the reply. I did get todays date with your new Date().getTime()
But it shows me nothing when I try to get new Date().getTime() - doc['duedate'].getTime() and I tried representing it as date, string, number, nothing happens. And it doesnt give any compile or runtime errors?
I tried that and I also did (new Date().getTime()) - doc['duedate'].value()
Tried to represent as Number String and date nothing. Both give me 0 results on visualization. But I can get results for new Date().getTime()
I'm sorry, I confirmed your option without checking closely. You should do it without the parenthesis for value as that is a property and not a method for that doc type.
So it should look like this: new Date().getTime() - doc['duedate'].value
Also, if you want to get a nice readable output for that field, you should set the Format to Number, the Type to Duration and the Input Format to milliseconds
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.