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

Different numHits 0.90.1 vs 0.90.2 filter with lookup terms #3367

Closed
scoolen opened this issue Jul 23, 2013 · 8 comments
Closed

Different numHits 0.90.1 vs 0.90.2 filter with lookup terms #3367

scoolen opened this issue Jul 23, 2013 · 8 comments
Assignees

Comments

@scoolen
Copy link

scoolen commented Jul 23, 2013

Hi,

When I run an identical query on 0.90.1 and 0.90.2 I get different results:

{
  "filter": {
    "terms": {
      "field": {
        "id": "bar",
        "type": "doctype",
        "path": "lookupField"
      }
    }
  },
  "query": {
    "match_all": {}
  }
}

In 0.90.1 when filter returned no results the result of the query was also empty, i.e. 0 hits.
In 0.90.2 it returns everything. The latter behavior is probably better and more expected, but I haven't seen it documented anywhere. Did I miss something?

@ghost ghost assigned martijnvg Jul 23, 2013
@scoolen
Copy link
Author

scoolen commented Jul 23, 2013

There is a little bit more going on...

0.90.2 returns a MatchNoDocsQuery when it is the only filter applied, but returns all results when combined with a filter that returns everything (e.g. via an and filter).

@martijnvg
Copy link
Member

@scoolen Do you have a particular test case for this change in behaviour? I'm curious if the document specified in the terms filter exists or if the path field exists.

I think the 0.90.1 behaviour is expected behaviour in most cases.

@scoolen
Copy link
Author

scoolen commented Jul 23, 2013

Yes, I tested a couple of scenarios while switching back and forth between version 0.90.1 and 0.90.2:

  1. Test with single lookup terms filter
  2. Test with compound filter (type filter AND lookup)
  3. Test with compound filter with just a single sub filter (lookup terms)

I tested these three scenarios with known values:

  1. Empty lookup (no results)
  2. No matching document lookup
  3. Lookup with expected number of results

@martijnvg
Copy link
Member

@scoolen I can confirm the difference in behaviour in both versions. It isn't reproducible in the current 0.90 and master branch. The following unreleased commit fixes this issue: 74a7c46

In case a filter is resolved to null which for example happens when a terms filter lookup can't find a document (but potentially also other filters return null) and in the case when there is no query, this just returns all docs. This issue has been has been fixed with the above commit.

In 0.90.1 the terms filter didn't return null and that is why this behaviour didn't occur in that version.

@Dynom
Copy link

Dynom commented Jul 24, 2013

Excellent news!

@Dynom
Copy link

Dynom commented Jul 24, 2013

For reference: this seems like a duplicate of #3356

@scoolen
Copy link
Author

scoolen commented Jul 24, 2013

@martijnvg Ok cool. For now we will stick to 0.90.1 then. Thanks for your help.

@martijnvg
Copy link
Member

@Dynom This is a duplicate of #3356, it isn't specific to just terms filter. I will close this issue now.

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

No branches or pull requests

3 participants