Skip to content

Top level inner hits override query level inner hits #16218

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

Closed
zygfryd opened this issue Jan 26, 2016 · 1 comment
Closed

Top level inner hits override query level inner hits #16218

zygfryd opened this issue Jan 26, 2016 · 1 comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories

Comments

@zygfryd
Copy link

zygfryd commented Jan 26, 2016

In the presence of top level inner hits query level inner hits are missing from the result, even if there are no name collisions. This necessitates rewriting query level inner hits as top level inner hits with a duplicate of the main query, which I assume is suboptimal.

ES 2.1.1.

@martijnvg
Copy link
Member

@zygfryd Thanks for reporting this. This is indeed suboptimal and not expected behaviour.

Simple reproduction:

PUT index
{
  "mappings": {
    "parent" : {
    },
    "child" : {
      "_parent": {
        "type": "parent"
      }
    }
  }
}

PUT /index/parent/1
{ 
}

PUT /index/child/1?parent=1
{ 
}

GET /index/_search
{
  "query": {
    "has_child": {
      "type": "child",
      "query": {
        "match_all": {}
      },
      "inner_hits" : {}
    }
  },
  "inner_hits" : {
    "my-inner-hits" : {
      "type" : {
        "child" : {

        }
      }
    }
  }
}

Two inner hits are expected here, but instead only the top level inner hit is returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

3 participants