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

Comments

Projects
None yet
3 participants
@dakrone
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

This comment has been minimized.

Show comment
Hide comment
@kimchy

kimchy Jul 19, 2013

Member

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.

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 in 74a7c46 Jul 19, 2013

kimchy added a commit that referenced this issue Jul 19, 2013

top level filter not resulting in an actual filter is ignored
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

This comment has been minimized.

Show comment
Hide comment
@dakrone

dakrone Jul 19, 2013

Member

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

Member

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

top level filter not resulting in an actual filter is ignored
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