# 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:** 1\
**Showing post:** 2

<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.

---

_[View the full topic](https://discuss.elastic.co/t/query-on-where-a-date-field-is-tuesday-wednesday-or-thursday/170762)._
