# How to write query for free text elastic search for date field

**URL:** https://discuss.elastic.co/t/how-to-write-query-for-free-text-elastic-search-for-date-field/147151
**Category:** Elasticsearch
**Created:** [September 4, 2018, 6:16am UTC](https://discuss.elastic.co/t/how-to-write-query-for-free-text-elastic-search-for-date-field/147151 "2018-09-04T06:16:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![UrmilaKA](https://avatars.discourse-cdn.com/v4/letter/u/9fc29f/32.png) [@UrmilaKA](https://discuss.elastic.co/u/UrmilaKA)
#### Post date: [September 4, 2018, 6:16am UTC](https://discuss.elastic.co/t/how-to-write-query-for-free-text-elastic-search-for-date-field/147151/1 "2018-09-04T06:16:15Z")

</div>

Hi,

Currently the Date field is stored as long. How should I write free text elastic search query for finding the date.

in search text: 09/04/2018

data in elastic search: date: 1536041715846

---

<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: [September 4, 2018, 6:30am UTC](https://discuss.elastic.co/t/how-to-write-query-for-free-text-elastic-search-for-date-field/147151/2 "2018-09-04T06:30:20Z")

</div>

> Currently the Date field is stored as long

Do you mean that the mapping is a long for that field?  
If so, change the type for that field to be a `date` instead.

---

<div class="post-metadata">

### Author: ![UrmilaKA](https://avatars.discourse-cdn.com/v4/letter/u/9fc29f/32.png) [@UrmilaKA](https://discuss.elastic.co/u/UrmilaKA)
#### Post date: [September 4, 2018, 9:04am UTC](https://discuss.elastic.co/t/how-to-write-query-for-free-text-elastic-search-for-date-field/147151/3 "2018-09-04T09:04:04Z")

</div>

Thankyou

---

<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: [October 2, 2018, 9:04am UTC](https://discuss.elastic.co/t/how-to-write-query-for-free-text-elastic-search-for-date-field/147151/4 "2018-10-02T09:04:06Z")

</div>

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