Displaying weeks number as X labels

Hello,

we are currently in a process of using the ELK stack to create our monthly dashboards for the management.

previously, we were using custom Excel workbooks with specials queries. And those workbooks were agregating the datas by week (which is possible with Kibana), but also not displaying the full date (2020-08-19) but display instead the week number (2020-34).

We have tried for some time to find a way to do so with Kibana, but without success.

Is there a way to do so ?

If so, could someone point me to the right documentation ?

Thanks a lot.

@BenoitSERRA have you tried to define a scripted field you can later apply to the x-axis?

I think it could be something like what was suggested on https://discuss.elastic.co/t/weekyear-week-as-scripted-field/117770/2:

if (doc['@timestamp'] != null) {
    Instant instant = Instant.ofEpochMilli( doc['@timestamp'].value.millis );
    ZoneId zoneId = ZoneId.of ( "America/Los_Angeles" );
    DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
    DateTimeFormatter formatter = builder.appendPattern("YYYY'-W'ww").toFormatter();
    String formattedDate = formatter.format(
      ZonedDateTime.ofInstant ( instant , zoneId )
    );
    return formattedDate;
}

Cheers

Thank you very much for pointing me in the right direction. I've created a scripted field with Kibana and linked it to one of the indexes I want week number on.

I tried to make it a Date field by Kibana does not seemed to be able to use it.

So now I've made it a String field and modified the visualisation parameters to sort value Ascending and it works.

Thanks again very much !

1 Like

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