Time range query without "TO"


(Ivan) #1

Hi,

Since Elasticsearch 5.2 to 5.4.0 (I haven't checked other versions, but these were installed on my server) I was able to use the following statement in my queries:

timestamp: [now-2d now]

It worked just fine. When I've upgraded to 5.5.0 it stopped working and now throws an exception (https://pastebin.com/6XxifrMW) saying I must put "TO" between "now-2d" and "now".

I've checked release notes for 5.5 and failed to find anything that could explain the change in behavior.

If it was an intentional change, I'll have no problems with changing my queries, but I just want to confirm that it wasn't a side effect of changes in something else.


(David Pilato) #2

I agree that this is looking like a regression to me.

I checked it on 5.2.2 and 5.5.1 and your report is exact.
Would you like to open an issue?

If it was done on purpose I think it needs to be documented at least.


(Ivan) #3

Thanks for the reply!

Since you confirm it, then yes, I'll open an issue.

upd: https://github.com/elastic/elasticsearch/issues/25905


(Ivan) #4

Okey, it was a bug that it worked without "TO" :slight_smile:

This leniency was not intended and of course never documented :wink:
This is just a side effect of a sloppy rule in the parser and should be considered as bug.
The strict parsing has been introduced in:
https://issues.apache.org/jira/browse/LUCENE-7821
The query_string uses a strict parser that throws exceptions when the syntax is not valid. I don't think we should handle non-documented syntax forever just because they worked in some versions.
Sorry but you'll have to fix your query in es > 5.5.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.