Skip to content

Query string time zone not working #10477

@clintongormley

Description

@clintongormley

I have following code:

curl -XPUT 'http://localhost:9200/foo/?pretty' -d '{"mapping": {"tweets": {"properties": {"tweet_date": {"type": "date"}}}}}'
curl -XPOST 'http://localhost:9200/foo/tweets/1/' -d '{"tweet_date": "2015-04-05T23:00:00+0000"}'
curl -XPOST 'http://localhost:9200/foo/tweets/2/' -d '{"tweet_date": "2015-04-06T00:00:00+0000"}'
curl -XPOST 'http://localhost:9200/foo/_refresh?pretty'

curl -XGET 'http://localhost:9200/foo/tweets/_search?pretty' -d '{
    "query": {
        "query_string": {
            "query": "tweet_date:[2015-04-06T00:00:00+0200 TO 2015-04-06T23:00:00+0200]"
        }
    }
}'

curl -XGET 'http://localhost:9200/foo/tweets/_search?pretty' -d '{
    "query": {
        "query_string": {
            "query": "tweet_date:[2015-04-06T00:00:00 TO 2015-04-06T23:00:00]",
            "time_zone": "+0200"
        }
    }
}'

First query result:

{
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "foo",
      "_type" : "tweets",
      "_id" : "2",
      "_score" : 1.0,
      "_source":{"tweet_date": "2015-04-06T00:00:00+0000"}
    }, {
      "_index" : "foo",
      "_type" : "tweets",
      "_id" : "1",
      "_score" : 1.0,
      "_source":{"tweet_date": "2015-04-05T23:00:00+0000"}
    } ]
  }
}

Second query result:

{
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "foo",
      "_type" : "tweets",
      "_id" : "2",
      "_score" : 1.0,
      "_source":{"tweet_date": "2015-04-06T00:00:00+0000"}
    } ]
  }
}

Shouldn't these results be the same?

(Copied from #8164 (comment))

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions