Unable to query on date field

Hi,

I am unable to query on date type on the child mapping. Please see the gist
here:

(Most of the stuff in between is just dummy data creation. The interesting
part is the mapping at the top and the query results at the bottom)

As you can see, I get the right results when I query the Impressions field,
but I don't get any hits when I query the "Date" field. Why is that?

Hari

Haven't run your gist, but it seems like in your query, you specify the date as a numeric value, not as a string. Can you see if it works when you have the term query run on Date as a string?

On Saturday, July 2, 2011 at 11:17 PM, Hari Shankar wrote:

Hi,

I am unable to query on date type on the child mapping. Please see the gist here:

(Most of the stuff in between is just dummy data creation. The interesting part is the mapping at the top and the query results at the bottom)
The date query returns no hits but the Impressions query works · GitHub

As you can see, I get the right results when I query the Impressions field, but I don't get any hits when I query the "Date" field. Why is that?

Hari

I tried putting quotes around the date in the query, but that didn't work.
Or do you mean if I tried changing Date to string type?

On Sun, Jul 3, 2011 at 1:56 AM, Shay Banon shay.banon@elasticsearch.comwrote:

Haven't run your gist, but it seems like in your query, you specify the
date as a numeric value, not as a string. Can you see if it works when you
have the term query run on Date as a string?

On Saturday, July 2, 2011 at 11:17 PM, Hari Shankar wrote:

Hi,

I am unable to query on date type on the child mapping. Please see the gist
here:

(Most of the stuff in between is just dummy data creation. The interesting
part is the mapping at the top and the query results at the bottom)
The date query returns no hits but the Impressions query works · GitHub

As you can see, I get the right results when I query the Impressions field,
but I don't get any hits when I query the "Date" field. Why is that?

Hari

Missed that you also index the date as number. Here is a gist where you index the date as string (since its a string formatted date), and the query also uses a string for the input. The type needs to remain a string. 1061635’s gists · GitHub

On Saturday, July 2, 2011 at 11:34 PM, Hari Shankar wrote:

I tried putting quotes around the date in the query, but that didn't work. Or do you mean if I tried changing Date to string type?

On Sun, Jul 3, 2011 at 1:56 AM, Shay Banon <shay.banon@elasticsearch.com (mailto:shay.banon@elasticsearch.com)> wrote:

Haven't run your gist, but it seems like in your query, you specify the date as a numeric value, not as a string. Can you see if it works when you have the term query run on Date as a string?

On Saturday, July 2, 2011 at 11:17 PM, Hari Shankar wrote:

Hi,

I am unable to query on date type on the child mapping. Please see the gist here:

(Most of the stuff in between is just dummy data creation. The interesting part is the mapping at the top and the query results at the bottom)
The date query returns no hits but the Impressions query works · GitHub

As you can see, I get the right results when I query the Impressions field, but I don't get any hits when I query the "Date" field. Why is that?

Hari

Grr, last sentence should read: the type should remain a date.

On Saturday, July 2, 2011 at 11:53 PM, Shay Banon wrote:

Missed that you also index the date as number. Here is a gist where you index the date as string (since its a string formatted date), and the query also uses a string for the input. The type needs to remain a string. 1061635’s gists · GitHub

On Saturday, July 2, 2011 at 11:34 PM, Hari Shankar wrote:

I tried putting quotes around the date in the query, but that didn't work. Or do you mean if I tried changing Date to string type?

On Sun, Jul 3, 2011 at 1:56 AM, Shay Banon <shay.banon@elasticsearch.com (mailto:shay.banon@elasticsearch.com)> wrote:

Haven't run your gist, but it seems like in your query, you specify the date as a numeric value, not as a string. Can you see if it works when you have the term query run on Date as a string?

On Saturday, July 2, 2011 at 11:17 PM, Hari Shankar wrote:

Hi,

I am unable to query on date type on the child mapping. Please see the gist here:

(Most of the stuff in between is just dummy data creation. The interesting part is the mapping at the top and the query results at the bottom)
The date query returns no hits but the Impressions query works · GitHub

As you can see, I get the right results when I query the Impressions field, but I don't get any hits when I query the "Date" field. Why is that?

Hari

Great, that works, Thanks! Is there any reason why date as integer and date
as string are treated separately? Why doesn't the date as integer query
work?

On Sun, Jul 3, 2011 at 2:23 AM, Shay Banon shay.banon@elasticsearch.comwrote:

Grr, last sentence should read: the type should remain a date.

On Saturday, July 2, 2011 at 11:53 PM, Shay Banon wrote:

Missed that you also index the date as number. Here is a gist where you
index the date as string (since its a string formatted date), and the query
also uses a string for the input. The type needs to remain a string.
1061635’s gists · GitHub

On Saturday, July 2, 2011 at 11:34 PM, Hari Shankar wrote:

I tried putting quotes around the date in the query, but that didn't work.
Or do you mean if I tried changing Date to string type?

On Sun, Jul 3, 2011 at 1:56 AM, Shay Banon shay.banon@elasticsearch.comwrote:

Haven't run your gist, but it seems like in your query, you specify the
date as a numeric value, not as a string. Can you see if it works when you
have the term query run on Date as a string?

On Saturday, July 2, 2011 at 11:17 PM, Hari Shankar wrote:

Hi,

I am unable to query on date type on the child mapping. Please see the gist
here:

(Most of the stuff in between is just dummy data creation. The interesting
part is the mapping at the top and the query results at the bottom)
The date query returns no hits but the Impressions query works · GitHub

As you can see, I get the right results when I query the Impressions field,
but I don't get any hits when I query the "Date" field. Why is that?

Hari

Because its a number, not the format of the date.

On Sunday, July 3, 2011 at 9:37 AM, Hari Shankar wrote:

Great, that works, Thanks! Is there any reason why date as integer and date as string are treated separately? Why doesn't the date as integer query work?

On Sun, Jul 3, 2011 at 2:23 AM, Shay Banon <shay.banon@elasticsearch.com (mailto:shay.banon@elasticsearch.com)> wrote:

Grr, last sentence should read: the type should remain a date.

On Saturday, July 2, 2011 at 11:53 PM, Shay Banon wrote:

Missed that you also index the date as number. Here is a gist where you index the date as string (since its a string formatted date), and the query also uses a string for the input. The type needs to remain a string. 1061635’s gists · GitHub

On Saturday, July 2, 2011 at 11:34 PM, Hari Shankar wrote:

I tried putting quotes around the date in the query, but that didn't work. Or do you mean if I tried changing Date to string type?

On Sun, Jul 3, 2011 at 1:56 AM, Shay Banon <shay.banon@elasticsearch.com (mailto:shay.banon@elasticsearch.com)> wrote:

Haven't run your gist, but it seems like in your query, you specify the date as a numeric value, not as a string. Can you see if it works when you have the term query run on Date as a string?

On Saturday, July 2, 2011 at 11:17 PM, Hari Shankar wrote:

Hi,

I am unable to query on date type on the child mapping. Please see the gist here:

(Most of the stuff in between is just dummy data creation. The interesting part is the mapping at the top and the query results at the bottom)
The date query returns no hits but the Impressions query works · GitHub

As you can see, I get the right results when I query the Impressions field, but I don't get any hits when I query the "Date" field. Why is that?

Hari