Good morning,
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:
GET /prova/_search
{
"_source": {},
"script_fields": {
"a": {
"script": {
"lang": "painless",
"inline": "def a = '2017-09-27T00:00:00.000Z'; return a.date.year-doc['dt'].date.year"
}
}
}
}
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
Can you help me please?
Thanks!!