How can I calculate week of year for a heat map aggregation?

Hello

I am using this painless code

(doc['time_start_ts'].value.dayOfYear - doc['time_start_ts'].value.dayOfWeek + 10) / 7;

to get a week_of_year scripted filed. My goal is to create a heatmap (with diferent years) with this field in the x axis.

So I will need to add year to the scripted field in order to differentiate the same week number from two different years.

Besides I will need to order properly the field, to get a time sorted heatmap. I would use calendar view, but I guess the plugin is not compatible with version 7.6

Thank you

Hugo

You can split the chart twice, once on Year and another one on Week. This way there shouldn't be any overlap on weeks from different years and you would have a different heatmap for each year.

1 Like

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