Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query string time zone not working #10883

Merged
merged 1 commit into from Apr 29, 2015

Conversation

dadoonet
Copy link
Member

If you define exactly the same date range query using either DATE+0200 notation or DATE and set timezone: +0200, elasticsearch gives back different results:

DELETE foo
PUT /foo
{
  "mapping": {
    "tweets": {
      "properties": {
        "tweet_date": {
          "type": "date"
        }
      }
    }
  }
}

POST /foo/tweets/1/
{
  "tweet_date": "2015-04-05T23:00:00+0000"
}
POST /foo/tweets/2/
{
  "tweet_date": "2015-04-06T00:00:00+0000"
}

GET /foo/tweets/_search?pretty
{
    "query": {
        "query_string": {
            "query": "tweet_date:[2015-04-06T00:00:00+0200 TO 2015-04-06T23:00:00+0200]"
        }
    }
}
GET /foo/tweets/_search?pretty
{
    "query": {
        "query_string": {
            "query": "tweet_date:[2015-04-06T00:00:00 TO 2015-04-06T23:00:00]",
            "time_zone": "+0200"
        }
    }
}

This PR fixes it and will also allow us to add the same feature to simple_query_string as well in another PR.

Closes #10477.

If you define exactly the same date range query using either `DATE+0200` notation or `DATE` and set `timezone: +0200`, elasticsearch gives back different results:

```
DELETE foo
PUT /foo
{
  "mapping": {
    "tweets": {
      "properties": {
        "tweet_date": {
          "type": "date"
        }
      }
    }
  }
}

POST /foo/tweets/1/
{
  "tweet_date": "2015-04-05T23:00:00+0000"
}
POST /foo/tweets/2/
{
  "tweet_date": "2015-04-06T00:00:00+0000"
}

GET /foo/tweets/_search?pretty
{
    "query": {
        "query_string": {
            "query": "tweet_date:[2015-04-06T00:00:00+0200 TO 2015-04-06T23:00:00+0200]"
        }
    }
}
GET /foo/tweets/_search?pretty
{
    "query": {
        "query_string": {
            "query": "tweet_date:[2015-04-06T00:00:00 TO 2015-04-06T23:00:00]",
            "time_zone": "+0200"
        }
    }
}
```

This PR fixes it and will also allow us to add the same feature to simple_query_string as well in another PR.

Closes elastic#10477.
@jpountz
Copy link
Contributor

jpountz commented Apr 29, 2015

LGTM

@dadoonet dadoonet merged commit 880f4a0 into elastic:1.5 Apr 29, 2015
@kevinkluge kevinkluge removed the review label Apr 29, 2015
@dadoonet
Copy link
Member Author

This PR fixes it and will also allow us to add the same feature to simple_query_string as well in another PR.

@jpountz actually simple_query_string still not supports ranges in Lucene so we can't have that. :(

@dadoonet dadoonet deleted the issue/10477-timezone-qs branch April 29, 2015 16:35
@clintongormley clintongormley changed the title fix: query string time zone not working Query string time zone not working May 30, 2015
@clintongormley clintongormley added :Search/Mapping Index mappings, including merging and defining field types and removed :Dates labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Mapping Index mappings, including merging and defining field types v1.5.3 v1.6.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants