Date Range Query Not returning results from child table


(senthil prabhu) #1

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


(Tomislav Poljak) #2

Hi,
here (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 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...
-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.


(system) #3