Heatmap sorting working in Visualisation Editor but not in Dashboard


We want to create event dashboard, which would shown, how many log events came in Day of Week and Hour of day.
We have created dynamic fields for DayOfWeek and HourOfDay (number format). Which are then used in heatmap with histogram aggregation.

This is how the visualization looks in editor:

And this is how it looks like, when imported to dashboard:

Note how the heatmap is being reordered in dashboard and it looks correctly in editor. I also tried to do heatmap with term aggregation, where I tried to sort it alphabetically, but the result is the same.

Numbers in legend are also different. e.g. (0-700) vs. (0-1.2)
Are you sure this is the same visualisation?


The numbers are different, because there is filter applied in the dashboard. I will test the visualization with same filter, to see if it is same behavior.

Nevertheless, I thought that the "sort" settings handles it with no regards to a filter.


so I tested it a little bit, and it seems to be dependent on the number of records displayed, when there is enough documents, it sorts as defined, but when there is lower number of documents (time period shorter, or filter applied) then it doesnt have propper order

Few documents:

Many documents:

It starts to fall apart somewhere between 3000 - 4500 hits, where after those 4500, the order is OK.

If it helps, here is my url:

http://<IP ADDRESS>:9662/app/visualize#/edit/ace09d10-b4af-11eb-a1ae-35831924ac87?_g=(filters:!(),query:(language:kuery,query:'prometheus.labels.ucsm%20:%20dcpmuc*'),refreshInterval:(pause:!t,value:0),time:(from:now-13d,to:now))&_a=(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!((enabled:!t,id:'1',params:(),schema:metric,type:count),(enabled:!t,id:'2',params:(field:DayOfWeek,missingBucket:!f,missingBucketLabel:Missing,order:asc,orderBy:_key,otherBucket:!f,otherBucketLabel:Other,size:8),schema:segment,type:terms),(enabled:!t,id:'3',params:(exclude:!(''),field:HourOfDay,include:!(''),missingBucket:!f,missingBucketLabel:Missing,order:asc,orderBy:_key,otherBucket:!t,otherBucketLabel:Other,size:25),schema:group,type:terms)),params:(addLegend:!t,addTooltip:!t,colorSchema:'Green%20to%20Red',colorsNumber:10,colorsRange:!((from:0,to:1),(from:1,to:400),(from:400,to:799),(from:799,to:1198),(from:1198,to:1597)),enableHover:!f,invertColors:!f,legendPosition:top,percentageMode:!f,setColorRange:!f,times:!(),type:heatmap,valueAxes:!((id:ValueAxis-1,labels:(color:black,overwriteColor:!f,rotate:0,show:!t),scale:(defaultYExtents:!f,type:linear),show:!f,type:value))),title:'Event%20Distribution',type:heatmap))

Still not sure what is the issue raised.
Can you say what is the expected result and why?

So, simply said, I want to have dashboards, with ordered buckets, no matter filters, time range or number of documents.

Problem I have, is that buckets in visualizations are not ordered alphabetically (term aggregation) nor numerically (histogram) when I dont have enough documents in those buckets - at least that is my observation

Please demonstrate that.



sorry, maybe I didn't make myself clear enough :slight_smile:

Here is dashboard I made with a lot of documents (with light filter as well):

Here is dashboard when I apply filter to reduce count of documents significantly:

Here is detail of the visualization (how I created it):

Maybe I should also note, that these fields are scripted in kibana as follows:

HourOfDay : LocalDateTime.ofInstant(Instant.ofEpochMilli(doc['DateCreated'].value.millis), ZoneId.of('CET')).getHour()

DayOfWeek: doc['DateCreated'].value.dayOfWeek

If anything more is needed, just ask :slight_smile:

And what is the issue?

And what is the issue?

Sorting of heatmap buckets not working.

Sorry, Maybe someone else will understand.
Good luck

I dont know how to write it probably.

How I need Y-axis buckets ordered:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24

How I have Y-axis bucktes ordered:

I've defined the ordering as alphabetical - but what you see above is not alphabetical nor numercial - it is random. That is why I think it is a bug.

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