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

Explain api parses wrong date range query when using "now" #3626

Closed
javanna opened this issue Sep 5, 2013 · 0 comments
Closed

Explain api parses wrong date range query when using "now" #3626

javanna opened this issue Sep 5, 2013 · 0 comments

Comments

@javanna
Copy link
Member

javanna commented Sep 5, 2013

Same problem as #3625, but with the explain api.
When using the explain API with date range queries that contain now (e.g. [* TO now-1d]), the parsed query contains a negative number that leads to a no match being returned. The following curl reproduction shows the different result obtained using the search API and the explain API.

curl -XPUT localhost:9200/index1/type1/1 -d '{
  "date": "2013-09-03T15:07:47.000Z"
}
'

curl -XPOST localhost:9200/index1/_refresh

#one hit gets returned (id 1) using search api
curl -XGET localhost:9200/index1/_search -d '
{ 
    "query" : {
        "query_string": {
            "query": "date:[* TO now-1d]"
        }   
    }
}
'
#explain api says the document doesn't match
curl -XGET localhost:9200/index1/type1/1/_explain -d '
{ 
    "query_string": {
      "query": "date:[* TO now-1d]"
    }
}
'
@ghost ghost assigned javanna Sep 5, 2013
javanna added a commit to javanna/elasticsearch that referenced this issue Sep 17, 2013
…"NOW" can be used within queries

Added nowInMillis to ExplainRequest in a backwards compatible manner

Fixes elastic#3626
javanna added a commit that referenced this issue Sep 20, 2013
…"NOW" can be used within queries

Added nowInMillis to ExplainRequest in a backwards compatible manner

Fixes #3626
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…"NOW" can be used within queries

Added nowInMillis to ExplainRequest in a backwards compatible manner

Fixes elastic#3626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant