# Date Range Query Not returning results from child table

**URL:** <https://discuss.elastic.co/t/date-range-query-not-returning-results-from-child-table/5267>\
**Category:** Elasticsearch\
**Created:** [August 28, 2011, 1:11pm UTC](https://discuss.elastic.co/t/date-range-query-not-returning-results-from-child-table/5267 "2011-08-28T13:11:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![senthil\_prabhu](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@senthil\_prabhu](https://discuss.elastic.co/u/senthil_prabhu)\
**Post date:** [August 28, 2011, 1:11pm UTC](https://discuss.elastic.co/t/date-range-query-not-returning-results-from-child-table/5267/1 "2011-08-28T13:11:03Z")

</div>

Hi,

```
    below is the mapping of my child table.

```

{  
"date1" : {  
"\_routing" : {  
"required" : true  
},  
"properties" : {  
"fieldname" : {  
"omit\_term\_freq\_and\_positions" : false,  
"index" : "analyzed",  
"omit\_norms" : false,  
"store" : "yes",  
"format" : "MMM/dd/yyyy HH:mm:ss",  
"type" : "date"  
}  
},  
"\_parent" : {  
"type" : "myparent"  
}  
}  
}

values stored in ES index look like Aug/28/2011 18:26:58, Sep/15/2011  
00:00:00

below is the query am executing

curl -XGET ' [http://127.0.0.1:9200/index1/myparent/\_search?search\_type=dfs\_query\_then\_fetch](http://127.0.0.1:9200/index1/myparent/_search?search_type=dfs_query_then_fetch)'  
-d '{"query":{ "has\_child" : {"type" : "date1", "query" :{ "range" :  
{ "fieldname" : { "from" : "Aug/20/2011 00:00:00", "to" : "Sep/20/2011  
00:00:00","include\_lower" : true,"include\_upper" : true,"boost" :  
1.0 } } }} }}'

its not returning any result. eventhough it has value in the specified  
range. if i search on the parent table date field it is returning  
results as expected.

is there anything am doing wrong.

---

<div class="post-metadata">

**Author:** ![Tomislav\_Poljak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomislav_poljak/32/1177_2.png) [@Tomislav\_Poljak](https://discuss.elastic.co/u/Tomislav_Poljak)\
**Post date:** [August 29, 2011, 1:06pm UTC](https://discuss.elastic.co/t/date-range-query-not-returning-results-from-child-table/5267/2 "2011-08-29T13:06:51Z")

</div>

Hi,  
here ([date\_range\_query\_on\_child\_types · GitHub](https://gist.github.com/1178344)) is a step-by-step  
reconstruction (using your data and query) which shows/proves date  
range queries on child types work correctly.

Tomislav

On Aug 28, 3:11 pm, Senthil Sebi [senthils...@gmail.com](mailto:senthils...@gmail.com) wrote:

> Hi,
> 
> ```
> below is the mapping of my child table.
> 
> ```
> 
> {  
> "date1" : {  
> "\_routing" : {  
> "required" : true  
> },  
> "properties" : {  
> "fieldname" : {  
> "omit\_term\_freq\_and\_positions" : false,  
> "index" : "analyzed",  
> "omit\_norms" : false,  
> "store" : "yes",  
> "format" : "MMM/dd/yyyy HH:mm:ss",  
> "type" : "date"  
> }  
> },  
> "\_parent" : {  
> "type" : "myparent"  
> }  
> }
> 
> }
> 
> values stored in ES index look like Aug/28/2011 18:26:58, Sep/15/2011  
> 00:00:00
> 
> below is the query am executing
> 
> curl -XGET '[http://127.0.0.1:9200/index1/myparent/\_search?search\_type=dfs\_query\_t](http://127.0.0.1:9200/index1/myparent/_search?search_type=dfs_query_t)...  
> -d '{"query":{ "has\_child" : {"type" : "date1", "query" :{ "range" :  
> { "fieldname" : { "from" : "Aug/20/2011 00:00:00", "to" : "Sep/20/2011  
> 00:00:00","include\_lower" : true,"include\_upper" : true,"boost" :  
> 1.0 } } }} }}'
> 
> its not returning any result. eventhough it has value in the specified  
> range. if i search on the parent table date field it is returning  
> results as expected.
> 
> is there anything am doing wrong.

---

<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 6, 2017, 3:55am UTC](https://discuss.elastic.co/t/date-range-query-not-returning-results-from-child-table/5267/3 "2017-07-06T03:55:45Z")

</div>


