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

Missing filter works differently in top-level versus filtered query #3356

Closed
dakrone opened this issue Jul 19, 2013 · 2 comments
Closed

Missing filter works differently in top-level versus filtered query #3356

dakrone opened this issue Jul 19, 2013 · 2 comments

Comments

@dakrone
Copy link
Member

dakrone commented Jul 19, 2013

Given the following script: https://gist.github.com/dakrone/6034875

I was expecting the same output for both queries (no documents matched), but instead I get:

∴ ./missing-filter-bug.zsh
Regular filter for null_value=true, existence=false
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "missing-test",
      "_type" : "doc",
      "_id" : "1",
      "_score" : 1.0, "_source" : { "id": "1" }
    }, {
      "_index" : "missing-test",
      "_type" : "doc",
      "_id" : "2",
      "_score" : 1.0, "_source" : { "id": "2", "myfield": "foo" }
    } ]
  }
}
Filtered query with filter for null_value=true, existence=false
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}
@ghost ghost assigned bleskes Jul 19, 2013
@kimchy
Copy link
Member

kimchy commented Jul 19, 2013

I hope its intentional the usage of null value set to true on hte missing filter, and not really have a null value on the mapping. It is a bug, which happens because the missing filter returns a null filter which ends up not matching anything with a filtered query, compared to top level filter.

@kimchy kimchy closed this as completed in 74a7c46 Jul 19, 2013
kimchy added a commit that referenced this issue Jul 19, 2013
when parsing a filter, we use null to indicate that this filter should not match anything, the top level filter doesn't take it into account
fixes #3356
@dakrone
Copy link
Member Author

dakrone commented Jul 19, 2013

Yea, it was intentional, just trying to make the reproduce script as small as possible. Thanks for the fix!

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
when parsing a filter, we use null to indicate that this filter should not match anything, the top level filter doesn't take it into account
fixes elastic#3356
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

3 participants