# Query on where a date field is Tuesday, Wednesday or Thursday

**URL:** <https://discuss.elastic.co/t/query-on-where-a-date-field-is-tuesday-wednesday-or-thursday/170762>\
**Category:** Elasticsearch\
**Created:** [March 4, 2019, 4:21pm UTC](https://discuss.elastic.co/t/query-on-where-a-date-field-is-tuesday-wednesday-or-thursday/170762 "2019-03-04T16:21:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cis4life](https://avatars.discourse-cdn.com/v4/letter/c/82dd89/32.png) [@cis4life](https://discuss.elastic.co/u/cis4life)\
**Post date:** [March 4, 2019, 4:21pm UTC](https://discuss.elastic.co/t/query-on-where-a-date-field-is-tuesday-wednesday-or-thursday/170762/1 "2019-03-04T16:21:21Z")

</div>

Good Day,

I have a field in my documents named 'measurement\_timestamp' and I want to query it where that timestamp is on either Tuesday, Wednesday or Thursday. I know its possible, but can't find just a straight kinda of answer and example. I'm using the latest docker version of ES. Any kind of insight would greatly be appreciated.

Thanks,

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 4, 2019, 4:40pm UTC](https://discuss.elastic.co/t/query-on-where-a-date-field-is-tuesday-wednesday-or-thursday/170762/2 "2019-03-04T16:40:47Z")

</div>

The best thing to do is to compute this day of the week field at index time.  
You can do that with a Painless processor I think.

I wrote an example here:

> [@Issue with date format change while reindexing](https://discuss.elastic.co/t/issue-with-date-format-change-while-reindexing/169590/11):
>
> Here is a way to do it: POST \_ingest/pipeline/\_simulate { "pipeline" :{ "description": "date pipeline ", "processors": [{ "script": { "source": """ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); ctx.person.birthDate = format.format(format.parse(ctx.person.birthDate)); """ } }]}, "docs": [ { "\_index": "index", "\_type": "\_doc", "\_id": "id", "\_source": { "person":…

It's not computing the day of the week though but that should be easy to adapt.

---

<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 1, 2019, 4:40pm UTC](https://discuss.elastic.co/t/query-on-where-a-date-field-is-tuesday-wednesday-or-thursday/170762/3 "2019-04-01T16:40:47Z")

</div>

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