# Indexing day of week

**URL:** <https://discuss.elastic.co/t/indexing-day-of-week/47268>\
**Category:** Kibana\
**Created:** [April 13, 2016, 2:39pm UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268 "2016-04-13T14:39:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![saba\_soltani](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@saba\_soltani](https://discuss.elastic.co/u/saba_soltani)\
**Post date:** [April 13, 2016, 2:39pm UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/1 "2016-04-13T14:39:50Z")

</div>

Hi,

I have recently started to work with kibana . I am running kibana from server.  
I have timestamp filed in my dataset which format is "YYYY-MM-DD HH:MM:SS".  
I want to have visualization based on "Day Of Week" in kibana. But I don't know  
how to index day-of-week as a separate field in Elasticsearch and use it in kibana.

Would you please help me with this?

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [April 13, 2016, 10:16pm UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/2 "2016-04-13T22:16:34Z")

</div>

This should be easy to accomplish 🙂

Just create a visualization with a date histogram with the `Interval` set to Daily. It should look like this:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/b/b8acbe4a32a4d52f0fbebeb00b9bc9ac6b737998.png)

---

<div class="post-metadata">

**Author:** ![saba\_soltani](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@saba\_soltani](https://discuss.elastic.co/u/saba_soltani)\
**Post date:** [April 14, 2016, 7:29am UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/3 "2016-04-14T07:29:01Z")

</div>

Actually, this is not what I mean. For example, there is a data set about sales of a branch of famous brand . Each log contains information about date of sale , item, price, address of branch ,...... We want to see changes in amount of sale for each day of week during specific period of time (last three months) and for instance, finding the day in which average of sales is the highest compared to the other days in week. In this case, we can have a good vision over different days in week.

---

<div class="post-metadata">

**Author:** ![tomr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomr/32/48260_2.png) [@tomr](https://discuss.elastic.co/u/tomr)\
**Post date:** [April 14, 2016, 4:07pm UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/4 "2016-04-14T16:07:54Z")

</div>

Consult this doc:  
[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)

It appears that day of month is in, but it doesn't look like day of week is. It's a bit frustrating. I'd be curious to know whether there was a good reason to leave it out.

Anyway, the good news is that you can use logstash to enrich your documents with a Day of Week field on the way in. See this thread:  
[https://groups.google.com/d/msg/logstash-users/uZVFwOpBHTI/iDV-GoeUZMEJ](https://groups.google.com/d/msg/logstash-users/uZVFwOpBHTI/iDV-GoeUZMEJ)

---

<div class="post-metadata">

**Author:** ![alainc](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@alainc](https://discuss.elastic.co/u/alainc)\
**Post date:** [April 15, 2016, 1:02am UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/5 "2016-04-15T01:02:23Z")

</div>

i also found this but not tested right now

> **[mikebski/logstash-filter-datepart](https://github.com/mikebski/logstash-filter-datepart)**
>
> logstash-filter-datepart - Plugin for logstash that will generate date fields for events; e.g. day of week, month of year, hour of day, etc...

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [April 18, 2016, 4:37pm UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/6 "2016-04-18T16:37:16Z")

</div>

Sorry for the misunderstanding. As the others have implied, I don't think this is currently possible without re-indexing the data. As tomr mentioned, logstash would be a good option.

Elasticsearch is also working on a new, more powerful (than Lucene expressions) scripting language that will be secure and enabled by default. It won't be available until 5.0 and it looks like it might not support date math yet, but I know the ES folks would love to get feedback about what features they should add next. This scripting language will probably be the easiest option for implementing things like this in the future.

> <https://github.com/elastic/elasticsearch/pull/15136>

---

<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:55pm UTC](https://discuss.elastic.co/t/indexing-day-of-week/47268/7 "2017-07-06T13:55:48Z")

</div>


