Querying for dates

Is it possible to query for date values without using a range query or a
field query. I can successfully run

"query": {
"bool": {
"must": [
{
"range": {
"releaseDate": {
"from": "2011-05-25",
"to": "2011-05-26",
"include_lower": true,
"include_upper": false,
"boost": 2
}
}
}
]
}
}

to get items with release date of '2011-05-25. This query correctly returns
100 records.

When I run

"query": {
"bool": {
"must": {
"term": {
"releaseDate": "2011-05-25"
}
}
}
}

I get no results.

Using

"query": {
"bool": {
"must": {
"query_string": {
"query": "2011-05-25"
}
}
}
}

returns all the records in the data set.

Could someone explain this behavior? How can I run a query similar to the
last one and only get the records having '2011-05-25' as one of the
attributes?

Thank you,

Michael

It seems that your mapping is not correct.Your use case suggests that you
only want search results for a single day: set index:not_analyzed and
type:string for the field "releaseDate" of your mapping, and then use term
query.

-- Tanguy

Le lundi 11 juin 2012 21:11:01 UTC+2, Michael Smolyak a écrit :

Is it possible to query for date values without using a range query or a
field query. I can successfully run

"query": {
"bool": {
"must": [
{
"range": {
"releaseDate": {
"from": "2011-05-25",
"to": "2011-05-26",
"include_lower": true,
"include_upper": false,
"boost": 2
}
}
}
]
}
}

to get items with release date of '2011-05-25. This query correctly
returns 100 records.

When I run

"query": {
"bool": {
"must": {
"term": {
"releaseDate": "2011-05-25"
}
}
}
}

I get no results.

Using

"query": {
"bool": {
"must": {
"query_string": {
"query": "2011-05-25"
}
}
}
}

returns all the records in the data set.

Could someone explain this behavior? How can I run a query similar to the
last one and only get the records having '2011-05-25' as one of the
attributes?

Thank you,

Michael