Date range query ignore month


(fatih) #1

Hi guys,

I've been using Elasticsearch as my data store and I got lots of documents
in it. My problem is, I figured it out that Elasticsearch does ignore month
field regarding mapping and I can not get real search response.

Here is what I have in my index and my query, please tell me if I'm wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" :
{"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss"
}}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14
04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014 and
30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.

--
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/6ee655cf-9e77-439f-9aac-8255efafcb2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Umut Yerci) #2

Yes, I was faced same problem in my db. After that I tried these code. I
think XGET reqeusts' query does not work well.

On Wednesday, April 30, 2014 4:28:16 PM UTC+3, Fatih Karatana wrote:

Hi guys,

I've been using Elasticsearch as my data store and I got lots of
documents in it. My problem is, I figured it out that Elasticsearch does
ignore month field regarding mapping and I can not get real search
response.

Here is what I have in my index and my query, please tell me if I'm wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" :
{"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss"
}}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14
04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014 and
30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.

--
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/7393b6eb-ddcc-406d-b560-ee196aeaed74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(eunever32) #3

Hi

I don't see the answer from the second post ?

I have the same problem :

PUT tweet
PUT tweet/tweet/_mapping
{
"tweet" : {
"_timestamp" : {
"enabled" : true,
"path" : "post_date",
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
}
}
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}
PUT tweet/tweet/3
{
"field1": "value",
"post_date": "2009-09-15 14:12:12"
}
PUT tweet/tweet/2
{
"field1": "value",
"post_date": "2009-10-15 14:12:12"
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}

Neither of these queries returns any documents : seems that any date with
year 2009 is considered outside the range

GET tweet/_search
{
"query": {
"range": {
"post_date": {
"from": "2009-01-01",
"to": "2009-12-01"
}
}
}
}
GET /tweet/_search
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"post_date" : {
"gte" : "2009-01-01",
"lt" : "2009-12-31"
}
}
}
}
}
}

On Wednesday, April 30, 2014 2:28:16 PM UTC+1, Fatih Karatana wrote:

Hi guys,

I've been using Elasticsearch as my data store and I got lots of
documents in it. My problem is, I figured it out that Elasticsearch does
ignore month field regarding mapping and I can not get real search
response.

Here is what I have in my index and my query, please tell me if I'm wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" :
{"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss"
}}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14
04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014 and
30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.

--
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/9d494ca7-523e-467f-886a-0fe04e9e1223%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #4

I might be wrong but you did not define any mapping for the post_date field itself.
I guess it could be the cause here. So your post_date field is a String with a standard analyzer which produce 2009 as one of the token.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 8 août 2014 à 00:04:27, eunever32@gmail.com (eunever32@gmail.com) a écrit:

Hi

I don't see the answer from the second post ?

I have the same problem :

PUT tweet
PUT tweet/tweet/_mapping
{
"tweet" : {
"_timestamp" : {
"enabled" : true,
"path" : "post_date",
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
}
}
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}
PUT tweet/tweet/3
{
"field1": "value",
"post_date": "2009-09-15 14:12:12"
}
PUT tweet/tweet/2
{
"field1": "value",
"post_date": "2009-10-15 14:12:12"
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}

Neither of these queries returns any documents : seems that any date with year 2009 is considered outside the range

GET tweet/_search
{
"query": {
"range": {
"post_date": {
"from": "2009-01-01",
"to": "2009-12-01"
}
}
}
}
GET /tweet/_search
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"post_date" : {
"gte" : "2009-01-01",
"lt" : "2009-12-31"
}
}
}
}
}
}

On Wednesday, April 30, 2014 2:28:16 PM UTC+1, Fatih Karatana wrote:
Hi guys,

I've been using Elasticsearch as my data store and I got lots of documents in it. My problem is, I figured it out that Elasticsearch does ignore month field regarding mapping and I can not get real search response.

Here is what I have in my index and my query, please tell me if I'm wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" : {"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss" }}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14 04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014 and 30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.

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/9d494ca7-523e-467f-886a-0fe04e9e1223%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.53e3fa36.216231b.18f0%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/d/optout.


(eunever32) #5

Thanks David

So I tried to define the post_date field of type date

and then put the document with the post_date, hoping it would store the
timestamp.

PUT tweet/tweet/_mapping
{
"tweet" : {

    "_timestamp" : {
        "enabled" : true,
        "path" : "post_date"
    }, 
    "properties" : {
        "post_date" : {"type" : "date"},
        "priority" : {"type" : "integer"},
        "rank" : {"type" : "float"}
    }
    
}

}
PUT tweet/tweet/1
{
"post_date": "2009-11-15"
}

I tried various values for post_date but always getting this error:

{
"error": "ElasticsearchParseException[failed to parse doc to extract
routing/timestamp/id]; nested: TimestampParsingException[failed to parse
timestamp [2009-11-15]]; ",
"status": 400
}

any assistance appreciated

On Thursday, August 7, 2014 11:14:30 PM UTC+1, David Pilato wrote:

I might be wrong but you did not define any mapping for the post_date
field itself.
I guess it could be the cause here. So your post_date field is a String
with a standard analyzer which produce 2009 as one of the token.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr

Le 8 août 2014 à 00:04:27, eune...@gmail.com <javascript:> (
eune...@gmail.com <javascript:>) a écrit:

Hi

I don't see the answer from the second post ?

I have the same problem :

PUT tweet
PUT tweet/tweet/_mapping
{
"tweet" : {
"_timestamp" : {
"enabled" : true,
"path" : "post_date",
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
}
}
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}
PUT tweet/tweet/3
{
"field1": "value",
"post_date": "2009-09-15 14:12:12"
}
PUT tweet/tweet/2
{
"field1": "value",
"post_date": "2009-10-15 14:12:12"
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}

Neither of these queries returns any documents : seems that any date with
year 2009 is considered outside the range

GET tweet/_search
{
"query": {
"range": {
"post_date": {
"from": "2009-01-01",
"to": "2009-12-01"
}
}
}
}
GET /tweet/_search
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"post_date" : {
"gte" : "2009-01-01",
"lt" : "2009-12-31"
}
}
}
}
}
}

On Wednesday, April 30, 2014 2:28:16 PM UTC+1, Fatih Karatana wrote:

Hi guys,

I've been using Elasticsearch as my data store and I got lots of
documents in it. My problem is, I figured it out that Elasticsearch does
ignore month field regarding mapping and I can not get real search response.

Here is what I have in my index and my query, please tell me if I'm wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" :
{"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss"
}}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14
04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014 and
30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9d494ca7-523e-467f-886a-0fe04e9e1223%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9d494ca7-523e-467f-886a-0fe04e9e1223%40googlegroups.com?utm_medium=email&utm_source=footer
.
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/a040b389-2516-46e3-9559-8968955f42d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(eunever32) #6

Hey it works: I just defined type "date" no special formatting
I couldn't get the _timestamp to work!

But when I just use post_date: date and inserted a valid date it worked.

Thanks!

On Friday, August 8, 2014 1:16:14 AM UTC+1, eune...@gmail.com wrote:

Thanks David

So I tried to define the post_date field of type date

and then put the document with the post_date, hoping it would store the
timestamp.

PUT tweet/tweet/_mapping
{
"tweet" : {

    "_timestamp" : {
        "enabled" : true,
        "path" : "post_date"
    }, 
    "properties" : {
        "post_date" : {"type" : "date"},
        "priority" : {"type" : "integer"},
        "rank" : {"type" : "float"}
    }
    
}

}
PUT tweet/tweet/1
{
"post_date": "2009-11-15"
}

I tried various values for post_date but always getting this error:

{
"error": "ElasticsearchParseException[failed to parse doc to extract
routing/timestamp/id]; nested: TimestampParsingException[failed to parse
timestamp [2009-11-15]]; ",
"status": 400
}

any assistance appreciated

On Thursday, August 7, 2014 11:14:30 PM UTC+1, David Pilato wrote:

I might be wrong but you did not define any mapping for the post_date
field itself.
I guess it could be the cause here. So your post_date field is a String
with a standard analyzer which produce 2009 as one of the token.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr

Le 8 août 2014 à 00:04:27, eune...@gmail.com (eune...@gmail.com) a écrit:

Hi

I don't see the answer from the second post ?

I have the same problem :

PUT tweet
PUT tweet/tweet/_mapping
{
"tweet" : {
"_timestamp" : {
"enabled" : true,
"path" : "post_date",
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
}
}
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}
PUT tweet/tweet/3
{
"field1": "value",
"post_date": "2009-09-15 14:12:12"
}
PUT tweet/tweet/2
{
"field1": "value",
"post_date": "2009-10-15 14:12:12"
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}

Neither of these queries returns any documents : seems that any date with
year 2009 is considered outside the range

GET tweet/_search
{
"query": {
"range": {
"post_date": {
"from": "2009-01-01",
"to": "2009-12-01"
}
}
}
}
GET /tweet/_search
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"post_date" : {
"gte" : "2009-01-01",
"lt" : "2009-12-31"
}
}
}
}
}
}

On Wednesday, April 30, 2014 2:28:16 PM UTC+1, Fatih Karatana wrote:

Hi guys,

I've been using Elasticsearch as my data store and I got lots of
documents in it. My problem is, I figured it out that Elasticsearch does
ignore month field regarding mapping and I can not get real search response.

Here is what I have in my index and my query, please tell me if I'm
wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" :
{"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss"
}}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14
04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014
and 30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9d494ca7-523e-467f-886a-0fe04e9e1223%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/9d494ca7-523e-467f-886a-0fe04e9e1223%40googlegroups.com?utm_medium=email&utm_source=footer
.
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/d1b04f1c-3c0d-4902-ab85-7041823b760c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #7

Apply the same format for both _timestamp and post_date. This should work.

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

Le 8 août 2014 à 02:16, eunever32@gmail.com a écrit :

Thanks David

So I tried to define the post_date field of type date

and then put the document with the post_date, hoping it would store the timestamp.

PUT tweet/tweet/_mapping
{
"tweet" : {

    "_timestamp" : {
        "enabled" : true,
        "path" : "post_date"
    }, 
    "properties" : {
        "post_date" : {"type" : "date"},
        "priority" : {"type" : "integer"},
        "rank" : {"type" : "float"}
    }
    
}

}
PUT tweet/tweet/1
{
"post_date": "2009-11-15"
}

I tried various values for post_date but always getting this error:

{
"error": "ElasticsearchParseException[failed to parse doc to extract routing/timestamp/id]; nested: TimestampParsingException[failed to parse timestamp [2009-11-15]]; ",
"status": 400
}

any assistance appreciated

On Thursday, August 7, 2014 11:14:30 PM UTC+1, David Pilato wrote:
I might be wrong but you did not define any mapping for the post_date field itself.
I guess it could be the cause here. So your post_date field is a String with a standard analyzer which produce 2009 as one of the token.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 8 août 2014 à 00:04:27, eune...@gmail.com (eune...@gmail.com) a écrit:

Hi

I don't see the answer from the second post ?

I have the same problem :

PUT tweet
PUT tweet/tweet/_mapping
{
"tweet" : {
"_timestamp" : {
"enabled" : true,
"path" : "post_date",
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss"
}
}
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}
PUT tweet/tweet/3
{
"field1": "value",
"post_date": "2009-09-15 14:12:12"
}
PUT tweet/tweet/2
{
"field1": "value",
"post_date": "2009-10-15 14:12:12"
}
PUT tweet/tweet/1
{
"field1": "value",
"post_date": "2009-11-15 14:12:12"
}

Neither of these queries returns any documents : seems that any date with year 2009 is considered outside the range

GET tweet/_search
{
"query": {
"range": {
"post_date": {
"from": "2009-01-01",
"to": "2009-12-01"
}
}
}
}
GET /tweet/_search
{
"query" : {
"filtered" : {
"filter" : {
"range" : {
"post_date" : {
"gte" : "2009-01-01",
"lt" : "2009-12-31"
}
}
}
}
}
}

On Wednesday, April 30, 2014 2:28:16 PM UTC+1, Fatih Karatana wrote:
Hi guys,

I've been using Elasticsearch as my data store and I got lots of documents in it. My problem is, I figured it out that Elasticsearch does ignore month field regarding mapping and I can not get real search response.

Here is what I have in my index and my query, please tell me if I'm wrong:

curl -XPUT 'http://localhost:9200/tt6/' -d '{}'
curl -XPUT 'http://localhost:9200/tt6/tweet/_mapping' -d '{"tweet" : {"properties" : {"date" : {"type" : "date", "format": "YYYY-MM-DD HH:mm:ss" }}}}'
curl -XPUT 'http://localhost:9200/tt6/tweet/1' -d '{"date": "2014-02-14 04:00:45"}'

curl -XGET 'http://localhost:9200/tt6/_search' -d '
{
"query": {
"bool": {
"must": [
{
"range": {
"tweet.date": {
"from": "2014-12-01 00:00:00",
"to": "2014-12-30 00:00:00"
}
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"facets": {}
}'

And my response is
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "tt6",
"_type": "tweet",
"_id": "1",
"_score": 1,
"_source": {
"date": "2014-02-14 04:00:45",
"name": "test"
}
}
]
}
}

By given date range it must has no response beet 1st of December 2014 and 30th of December 2014, but it returns.

Any help will be appreciated.

Regards.

Fatih.
--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9d494ca7-523e-467f-886a-0fe04e9e1223%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/a040b389-2516-46e3-9559-8968955f42d0%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/39996F84-079B-4066-9A0C-A4AEC2D741B6%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(system) #8