How to get current date using painless langage

(Lutundula Jeanchris) #1

I just started coding in painless and i am looking for a way to get the current date , the current date - 1 day . i see so many functions and iam a bit lost , can someone help me .


(Alexander Reelsen) #2

can you explain a bit, what you are after and where you need this timestamp? Is there a chance you can inject it externally from your application via script parameters?

(Lutundula Jeanchris) #3

Hey , thanks for helping here's what i want to do in painless on my ELK

long datenow = new Date().getTime();
String domain ;
long previousdate = datenow - 860000 ;
for (from date now to previousdate) #thats the idea
domain += doc['usrName.keyword'];
return domain; #return all the domains

the goal its to inject it via script parameter (on a vizualise)

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.