# Need Weekdays from timestamp

**URL:** <https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123>\
**Category:** Kibana\
**Created:** [March 15, 2018, 3:02pm UTC](https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123 "2018-03-15T15:02:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarBel78](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marbel78/32/28822_2.png) [@MarBel78](https://discuss.elastic.co/u/MarBel78)\
**Post date:** [March 15, 2018, 3:02pm UTC](https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123/1 "2018-03-15T15:02:47Z")

</div>

Hi! I want to count a large dataset group by weekdays. With scripted fields is it too slow.  
How can i add new index field weekday given by timestamp?  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Bill\_McConaghy](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@Bill\_McConaghy](https://discuss.elastic.co/u/Bill_McConaghy)\
**Post date:** [March 15, 2018, 5:05pm UTC](https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123/2 "2018-03-15T17:05:19Z")

</div>

I would suggest adding that field before you send the data to Elasticsearch. You could accomplish this using Logstash I think. For details on how to do it, I would ask in the Logstash forum.

---

<div class="post-metadata">

**Author:** ![MarBel78](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marbel78/32/28822_2.png) [@MarBel78](https://discuss.elastic.co/u/MarBel78)\
**Post date:** [March 16, 2018, 9:19am UTC](https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123/3 "2018-03-16T09:19:56Z")

</div>

Thanks, this is my second solution - but it should be possible for existing data (20M datasets). It should possible to add calculated fields, so you can access them for the future rapidly.

---

<div class="post-metadata">

**Author:** ![Bill\_McConaghy](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@Bill\_McConaghy](https://discuss.elastic.co/u/Bill_McConaghy)\
**Post date:** [March 16, 2018, 1:37pm UTC](https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123/4 "2018-03-16T13:37:24Z")

</div>

You can definitely add a scripted field that would accomplish this, it's just going to be slow for large data sets (as you point out in your original post).

---

<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:** [April 13, 2018, 1:37pm UTC](https://discuss.elastic.co/t/need-weekdays-from-timestamp/124123/5 "2018-04-13T13:37:45Z")

</div>

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