Truncate part of an existing field value to a new field using painless?

852 views Asked by At

I'm having a timestamp field which has a value something like this , where pretty much all the values would be in the same format:

January 1st 2017, 05:29:59.000

What I need is to trim part of the above which should look:

January 1st 2017

So what I wanted to know is whether is it possible to do the above using painless scripting within Kibana itself? Something like assign the trimmed value to a new scripted field? I wanted to do it within Kibana , since I just wanted to show only the shorter format of the date in the graph.

Any help would be appreciated.

1

There are 1 answers

0
Kulasangar On BEST ANSWER

Wrote a painless scripted field, using the moment.js date formatting. But then I had to change the Popularity to 0 since having it as 1 didn't allow me to access the scripted field in the graph. Making it 0 worked. This is how my scripted_field look like:

enter image description here