-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add time_zone setting for query_string #8164
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
Add time_zone setting for query_string #8164
Conversation
|
This looks good, should we add the same feature to the |
|
@jpountz Indeed! That was my plan at the beginning and it sounds like I forgot it :) |
|
@jpountz Actually, |
|
LGTM |
aa92782 to
0ff61e1
Compare
|
@dadoonet Could you have a look please? Either this option not working or I don't understand how it should work. 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: Second query result: Shouldn't these results be the same? |
|
@im-denisenko I think they should. If you are using Elasticsearch 1.5.0, I'd open an issue with this great full reproduction script. |
|
@dadoonet Yes, this is 1.5.0 |
|
@im-denisenko Could you open an issue so we won't forget to add some tests and fix it? |
Query String query now supports a new
time_zoneoption based on JODA time zones.When using a range on date field, the time zone is applied.
{ "query": { "query_string": { "text": "date:[2012 TO 2014]", "timezone": "Europe/Paris" } } }Closes #7880.