Hi,
I am trying to use && operator in Kibana scripted field but it's not working. I am using following painless code.
def diff = new Date().getTime() - doc['OpenTime'].value;
def daysdiff = diff / 1000 / 60 / 60 / 24;
if (daysdiff >= 6) && (daysdiff <= 10) {
return "6 To 10 Days"
} else {
return "10+ Days"
}
One thing more, is it possible to use if elseif else in painless? If yes, how?
ppisljar
(Peter Pisljar)
June 17, 2017, 6:44am
2
it should be possible to use if/ else if/ else .... if not straight forward, with nesting if statements.
the and should also work, but your if syntax seems to be wrong
if (CONDITION1 && CONDITION2)
, not if (COND1) && (COND2)
(mind the parenthesis)
system
(system)
Closed
July 15, 2017, 6:45am
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.