Getting first 3 characters of month from date

How can we get only the first three characters of the month from a date field using a scripted field in kibana painless? Using getMonth() fetches the entire month. thanks

Hi @behappy_alwayz0401,
try this:

def month = doc['order_date'].value.getMonth().toString().substring(0,3);
return month;
1 Like

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