Searching on a date

Is there a way to search on a date or a number of dates.

I have a date field that is stored in the index as so:

"mydate":{
"type" : "date",
"index" : "not_analyzed",
"format" : "yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd"
},

but I want to be able to search for a document that has a particular date
(not a range query) i.e.

myDate:2012-05-14

or even search for documents that have these partiuclar dates

myDate:2012-05-14 OR myDate:2013-05-14

Is it possible to index a text version of the field and remove the time
stamp then I can treat it as this particualr date query as a text query.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

IMHO, you should remove it on client side prior to indexing.
Otherwise, using range queries is fine with dates. Why don't you want to use Range?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 17 mai 2013 à 16:25, es newbie dan.tuffery@gmail.com a écrit :

Is there a way to search on a date or a number of dates.

I have a date field that is stored in the index as so:

"mydate":{
"type" : "date",
"index" : "not_analyzed",
"format" : "yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd"
},

but I want to be able to search for a document that has a particular date (not a range query) i.e.

myDate:2012-05-14

or even search for documents that have these partiuclar dates

myDate:2012-05-14 OR myDate:2013-05-14

Is it possible to index a text version of the field and remove the time stamp then I can treat it as this particualr date query as a text query.

--
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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

You're right I can use range query for this search. Thanks

On Friday, May 17, 2013 3:25:31 PM UTC+1, es newbie wrote:

Is there a way to search on a date or a number of dates.

I have a date field that is stored in the index as so:

"mydate":{
"type" : "date",
"index" : "not_analyzed",
"format" : "yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd"
},

but I want to be able to search for a document that has a particular date
(not a range query) i.e.

myDate:2012-05-14

or even search for documents that have these partiuclar dates

myDate:2012-05-14 OR myDate:2013-05-14

Is it possible to index a text version of the field and remove the time
stamp then I can treat it as this particualr date query as a text query.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.