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 [email protected].
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.