# Passing date field throw rest

**URL:** https://discuss.elastic.co/t/passing-date-field-throw-rest/12072
**Category:** Elasticsearch
**Created:** [May 22, 2013, 11:46am UTC](https://discuss.elastic.co/t/passing-date-field-throw-rest/12072 "2013-05-22T11:46:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![abdo](https://avatars.discourse-cdn.com/v4/letter/a/0ea827/32.png) [@abdo](https://discuss.elastic.co/u/abdo)
#### Post date: [May 22, 2013, 11:46am UTC](https://discuss.elastic.co/t/passing-date-field-throw-rest/12072/1 "2013-05-22T11:46:38Z")

</div>

Hi all,

I am using PHP to write REST query to ES .I am trying to search my ES with a  
query that contains date field. This is my query:  
{"query":{"bool":{"must":{"range":{"timeGenerated":{"from":"2013/4/1  
09:14:08","to":"2013/4/1 09:14:08"}}}}}}

When I try this query it gives me no response from server -not empty-. When  
I remove the time portion from the date, it works!  
{"query":{"bool":{"must":{"range":{"timeGenerated":{"from":"2013/4/1","to":"2013/4/1"}}}}}}

Also I tried the tow queries from curl command line and it works fine.

regards,

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Passing-date-field-throw-rest-tp4035272.html](http://elasticsearch-users.115913.n3.nabble.com/Passing-date-field-throw-rest-tp4035272.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [May 24, 2013, 10:46am UTC](https://discuss.elastic.co/t/passing-date-field-throw-rest/12072/2 "2013-05-24T10:46:02Z")

</div>

Hi abdo

Check the mapping to see how your date field is mapped, and what date  
formats it accepts - that is likely the problem

clint

On 22 May 2013 13:46, abdo [abdo.a2008@gmail.com](mailto:abdo.a2008@gmail.com) wrote:

> Hi all,
> 
> I am using PHP to write REST query to ES .I am trying to search my ES with  
> a  
> query that contains date field. This is my query:  
> {"query":{"bool":{"must":{"range":{"timeGenerated":{"from":"2013/4/1  
> 09:14:08","to":"2013/4/1 09:14:08"}}}}}}
> 
> When I try this query it gives me no response from server -not empty-. When  
> I remove the time portion from the date, it works!
> 
> {"query":{"bool":{"must":{"range":{"timeGenerated":{"from":"2013/4/1","to":"2013/4/1"}}}}}}
> 
> Also I tried the tow queries from curl command line and it works fine.
> 
> regards,
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Passing-date-field-throw-rest-tp4035272.html](http://elasticsearch-users.115913.n3.nabble.com/Passing-date-field-throw-rest-tp4035272.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)
#### Post date: [February 9, 2016, 12:14pm UTC](https://discuss.elastic.co/t/passing-date-field-throw-rest/12072/3 "2016-02-09T12:14:29Z")

</div>

Is the problem solved? I have same issue. If you are solved this problem please help me. How did you solve this problem?

---

<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: [February 9, 2016, 5:18pm UTC](https://discuss.elastic.co/t/passing-date-field-throw-rest/12072/4 "2016-02-09T17:18:01Z")

</div>

Hijacking old threads won't help you. Please keep your questions in [Date format incorrect results](https://discuss.elastic.co/t/date-format-incorrect-results/40643/10)

---

<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 5, 2017, 11:17pm UTC](https://discuss.elastic.co/t/passing-date-field-throw-rest/12072/5 "2017-07-05T23:17:53Z")

</div>


