Script throwing error on visualisations: Caused by: java.lang.IllegalArgumentException: invalid sequence of tokens near ['}']

My script:
if (doc['companiesHouse.date_of_creation'].size()>0 && doc['awards.date'].size() > 0) { return ((doc['awards.date'].value.getMillis() - doc['companiesHouse.date_of_creation'].value.getMillis()) / 86400000); } return "";

both existing fields are mapped as dates.

Any advice would be appreciated!

Thanks,

Tom

Hello @twright8

Which version of the elastic stack are you using? Have you tried using the painless lab? https://www.elastic.co/guide/en/kibana/current/painlesslab.html

7.9! I dont really know how to use painless lab. is it worth learning then?

painless lab provides some IDE and debugging functionality which can be very useful when troubleshooting painless scripts.

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