# Day of Week

**URL:** https://discuss.elastic.co/t/day-of-week/33295
**Category:** Kibana
**Created:** [October 29, 2015, 7:56pm UTC](https://discuss.elastic.co/t/day-of-week/33295 "2015-10-29T19:56:04Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![erikstephens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikstephens/32/5430_2.png) [@erikstephens](https://discuss.elastic.co/u/erikstephens)
#### Post date: [October 29, 2015, 7:56pm UTC](https://discuss.elastic.co/t/day-of-week/33295/1 "2015-10-29T19:56:04Z")

</div>

I'm able to define scripted field like so in Kibana 4.2 and Elasticsearch 2.0:

```
doc['@timestamp'].getDayOfMonth()
doc['@timestamp'].getHourOfDay()

```

but can't figure out how to get the day of the week. I've tried:

```
doc['@timestamp'].getDayOfWeek()
doc['@timestamp'].dayOfWeek()

```

Which generates "Member method [getDayOfWeek] does not exist" in the error logs. Anyone able to get the day of the week in kibana scripted fields? Thanks!

---

<div class="post-metadata">

### Author: ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)
#### Post date: [October 30, 2015, 8:47am UTC](https://discuss.elastic.co/t/day-of-week/33295/2 "2015-10-30T08:47:20Z")

</div>

You might be better of asking your question in the Kibana forum here: [https://discuss.elastic.co/c/kibana](https://discuss.elastic.co/c/kibana)

---

<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: [October 30, 2015, 10:43am UTC](https://discuss.elastic.co/t/day-of-week/33295/3 "2015-10-30T10:43:46Z")

</div>

I've moved it 🙂

---

<div class="post-metadata">

### Author: ![erikstephens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikstephens/32/5430_2.png) [@erikstephens](https://discuss.elastic.co/u/erikstephens)
#### Post date: [October 30, 2015, 4:14pm UTC](https://discuss.elastic.co/t/day-of-week/33295/4 "2015-10-30T16:14:11Z")

</div>

It's my understanding that this is [more of an elasticsearch feature](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_lucene_expressions_scripts) that kibana happens to expose. I thought I read that timestamps adhere to the joda time interface but maybe elasticsearch only exposes a subset? If so, is there a reason why getDayOfWeek() was left out?

---

<div class="post-metadata">

### Author: ![stormpython](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stormpython/32/7190_2.png) [@stormpython](https://discuss.elastic.co/u/stormpython)
#### Post date: [November 4, 2015, 12:15am UTC](https://discuss.elastic.co/t/day-of-week/33295/5 "2015-11-04T00:15:04Z")

</div>

Kibana uses Lucene Expressions due to security concerns with what was previously used, Groovy (see [https://github.com/elastic/kibana/issues/3180](https://github.com/elastic/kibana/issues/3180)).  
Lucene expressions do not support getDayOfWeek(), [https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#\_lucene\_expressions\_scripts](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_lucene_expressions_scripts).

---

<div class="post-metadata">

### Author: ![erikstephens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erikstephens/32/5430_2.png) [@erikstephens](https://discuss.elastic.co/u/erikstephens)
#### Post date: [November 4, 2015, 12:51am UTC](https://discuss.elastic.co/t/day-of-week/33295/6 "2015-11-04T00:51:21Z")

</div>

Sounds like more of a Lucene issue to dive into. Strange that getDayOfWeek() is omitted - it's pretty important. If anyone comes up with a workaround, I'd love to see it.

---

<div class="post-metadata">

### Author: ![kay\_kay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kay_kay/32/1470_2.png) [@kay\_kay](https://discuss.elastic.co/u/kay_kay)
#### Post date: [October 31, 2016, 2:31pm UTC](https://discuss.elastic.co/t/day-of-week/33295/7 "2016-10-31T14:31:30Z")

</div>

one year late, but here is the solution: [How to print popular hour diagram in Kibana](https://discuss.elastic.co/t/how-to-print-popular-hour-diagram-in-kibana/64277)

---

<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: [July 6, 2017, 1:35pm UTC](https://discuss.elastic.co/t/day-of-week/33295/8 "2017-07-06T13:35:04Z")

</div>


