Searching by date range on field having timestamp doesn't returns me documents

Hi Team,

I want to search or get documents between the date range provided, my
document consists 1 field with name created having mapping as:
"created" : {

        "type" : "date",
        "format" : "dateOptionalTime"

}

& we store unix timestamp in this field. now when I query against this field with date (yyyy-mm-dd) it doesn't returns me any documents even if documents with that date converted into timestamp exists in ES.

I am running below query against my ES:

POST _search
{
"query": {"range": {
"created": {
"gt": "2014-01-01T00:00:00Z",
"lt": "2014-02-28T00:00:00Z"
}
}}
}

Now there are many documents in this range but created field has timestamp stored instead of date...per documentation on website I guess this should be possible...

@see: http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_ranges.html#_ranges_on_dates

Can any body help me with this issue?

Thanks in advance...

Regards,

Paresh Behede

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a57e2522-625a-4e35-a462-cb0f2e2fb7a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

You are using unix timestamp as is(seconds since epoch) instead of milliseconds since epoch in your documents, perhaps?

Masaru

On February 5, 2015 at 17:45:01, Paresh Behede (paresh2711@gmail.com) wrote:

Hi Team,

I want to search or get documents between the date range provided, my
document consists 1 field with name created having mapping as:
"created" : {

"type" : "date",
"format" : "dateOptionalTime"
}

& we store unix timestamp in this field. now when I query against this field with date (yyyy-mm-dd)
it doesn't returns me any documents even if documents with that date converted into timestamp
exists in ES.

I am running below query against my ES:

POST _search
{
"query": {"range": {
"created": {
"gt": "2014-01-01T00:00:00Z",
"lt": "2014-02-28T00:00:00Z"
}
}}
}

Now there are many documents in this range but created field has timestamp stored instead
of date...per documentation on website I guess this should be possible...

@see: Elasticsearch Platform — Find real-time answers at scale | Elastic

Can any body help me with this issue?

Thanks in advance...

Regards,

Paresh Behede

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a57e2522-625a-4e35-a462-cb0f2e2fb7a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.54d33435.4db127f8.1c2%40citra.local.
For more options, visit https://groups.google.com/d/optout.