How to customize format of date histogram in Kibana table visualization


#1

Hi,

I am using ELK GA 5.0.0. I have made a table visualization and selected Split Rows -> Aggregation -> Date Histogram and set Interval -> Daily. In my table, dates are coming like;

April 8th 2017, 00:00:00.000
April 9th 2017, 00:00:00.000
April 10th 2017, 00:00:00.000

etc. But I dont to display time, but date, like;

April 8th 2017
April 9th 2017
April 10th 2017

How can I do this? Thanks in advance..


(CJ Cenizal) #2

Hi elasticcloud! Nice to see you again. Here's a solution from another post: Visualizations using time only not date.

You just have to create a scripted field, select "string" type, and add this script:

def dateFormat = new SimpleDateFormat("MMM d yyyy");
return dateFormat.format(doc['your_time_field_name_here'].value);

Hope this helps,
CJ


#3

Hi @cjcenizal nice to see you too :slight_smile: , and I am still using that username :wink:

I have tried your solution and used Date type instead of String. and getting an error. Posted here Scripted date field returns Invalid date


(system) #4

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