# Heatmap 24h - 7d

**URL:** <https://discuss.elastic.co/t/heatmap-24h-7d/141192>\
**Category:** Kibana\
**Created:** [July 23, 2018, 2:14pm UTC](https://discuss.elastic.co/t/heatmap-24h-7d/141192 "2018-07-23T14:14:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![axi92](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axi92/32/33641_2.png) [@axi92](https://discuss.elastic.co/u/axi92)\
**Post date:** [July 23, 2018, 2:14pm UTC](https://discuss.elastic.co/t/heatmap-24h-7d/141192/1 "2018-07-23T14:14:49Z")

</div>

I can't get my heatmap to work.  
Days of Week at the X-Axis. (7 colums)  
Hours of the day at the Y-Axis (24)

Metrics: I use Count, because I want to count how many occurrences are in one hour.  
It looks like this at the moment:

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/a/2/a290f62075c80852a599f9da241ba18a59fb2baa.jpg)

But I want something like that:  
[https://discuss.elastic.co/uploads/short-url/51Qvc5AhgKGsvvqZC0RT4Rc19cR.png](https://discuss.elastic.co/uploads/short-url/51Qvc5AhgKGsvvqZC0RT4Rc19cR.png)

That is my mapping:  
{  
"properties": {  
"IP": {  
"type": "ip",  
"store": true  
},  
"address": {  
"type": "keyword",  
"store": true  
},  
"addressType": {  
"type": "keyword",  
"store": true  
},  
"channel": {  
"type": "short",  
"store": true  
},  
"date": {  
"type": "date",  
"format": "epoch\_millis"  
},  
"location": {  
"type": "keyword",  
"store": true  
},  
"rssi": {  
"type": "short",  
"store": true  
},  
"ssid": {  
"type": "keyword",  
"store": true  
},  
"type": {  
"type": "keyword",  
"store": true  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [July 24, 2018, 10:48pm UTC](https://discuss.elastic.co/t/heatmap-24h-7d/141192/2 "2018-07-24T22:48:16Z")

</div>

You're going to want to create two scripted fields: One for `hour_of_day` with a script of `doc['@timestamp'].value.hourOfDay`, and another for `day_of_week` with a script of `doc['@timestamp'].value.dayOfWeek`.

Once you've created these, you can use them in visualizations, and you'll want to do a heatmap visualization and select a histogram of `day_of_week` with interval of one for x-axis, and a histogram of `hour_of_day` with interval of one for the y-axis.

Hope that helps!

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/4/34570a0138f990fd270804a8bc2a6f6a7c9fd0dc.png)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 25, 2018, 12:01am UTC](https://discuss.elastic.co/t/heatmap-24h-7d/141192/3 "2018-07-25T00:01:25Z")

</div>

For a more effective option, you can also extra the hour and day into their own fields in the document and then run an agg directly. Scripts are great for adhoc stuff, but you really want to have their own fields in the long run.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 22, 2018, 12:01am UTC](https://discuss.elastic.co/t/heatmap-24h-7d/141192/4 "2018-08-22T00:01:30Z")

</div>

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