Organize Weekly Bar Graph by correct day order

Hi,

I currently created a weekly bar graph with the following scripted field :

LocalDateTime.ofInstant(Instant.ofEpochMilli(doc['xxx'].value.millis),ZoneId.of('Asia/Tokyo')).getDayOfWeek()

and the graph looks something like this

But I am trying to make it where it is organized into the week order. ( E.G. Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)

Is there a way to make it like that while keeping the time zone to tokyo? Thanks

There isn't a way to do this exactly, because Kibana doesn't know anything except that these are words that are sorted alphabetically or by another metric.

However, have you considered using the date histogram aggregation instead of the Terms aggregation? If you use a custom timezone and date formatter (in Kibana Advanced Settings, or on the date field in your index pattern) you could show days of the week.

Hi Wylie,

Would I have to create a new scripted field for that?

James

Date formatters are assigned to a field in your index pattern- it could be scripted, or it could be the original field. If it helps you organize, then it could be useful to create an alias field in your index mapping or to create a scripted field.

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