I'm doing examples of script fields and I have read the documentation but I don't understand how I can use date fields. My idea is get the age using scripts:
Exist the type Date? I have read that there is: String, list, map etc. but not date, and now when I declare this variable
is a String, and thisis the cause that I can't do ".date.year
You need to look at the Java8 time apis. You will need to parse your string date into probably a DateTime, then convert the ReadableDateTime (a joda class) to java 8's DateTime as well in order to compare.
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.