Hi!
Have tried a lot of things, like Java Instant.now().toEpochMilli()
or joda Days().toStandardDuration()
with no success.
Found out what while Java Instant class isn't accepted, Java System.currentTimeMillis() is.
My last try was:
"script":{
"script":{
"source":"doc['activated'].value.addDays(doc['duration']).getMillis() > System.currentTimeMillis()",
"lang":"painless"
}
}
But it fails with:
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"doc['activated'].value.addDays(doc['duration']).getMillis() > System.currentTimeMillis()",
" ^---- HERE"
],
"script": "doc['activated'].value.addDays(doc['duration']).getMillis() > System.currentTimeMillis()",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Unable to find dynamic method [addDays] with [1] arguments for class [org.joda.time.MutableDateTime]."
}
}
Here joda .getMillis() method is found and works as expected, while joda .addDays() method isn't found.
Feel so confused which Java and joda classes and methods are accepted with Script Queries, and how to accomplish my task.