{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/17291","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17291/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17291/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17291/events","html_url":"https://github.com/elastic/elasticsearch/pull/17291","id":143016233,"number":17291,"title":"Refactored inner hits parsing and intoduced InnerHitBuilder","user":{"login":"martijnvg","id":580421,"avatar_url":"https://avatars.githubusercontent.com/u/580421?v=3","gravatar_id":"","url":"https://api.github.com/users/martijnvg","html_url":"https://github.com/martijnvg","followers_url":"https://api.github.com/users/martijnvg/followers","following_url":"https://api.github.com/users/martijnvg/following{/other_user}","gists_url":"https://api.github.com/users/martijnvg/gists{/gist_id}","starred_url":"https://api.github.com/users/martijnvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martijnvg/subscriptions","organizations_url":"https://api.github.com/users/martijnvg/orgs","repos_url":"https://api.github.com/users/martijnvg/repos","events_url":"https://api.github.com/users/martijnvg/events{/privacy}","received_events_url":"https://api.github.com/users/martijnvg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Search%20Refactoring","name":":Search Refactoring","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/breaking","name":"breaking","color":"ff0000"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/review","name":"review","color":"0052cc"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v5.0.0","name":"v5.0.0","color":"dddddd"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-23T16:48:47Z","updated_at":"2016-03-25T01:59:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17291","html_url":"https://github.com/elastic/elasticsearch/pull/17291","diff_url":"https://github.com/elastic/elasticsearch/pull/17291.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/17291.patch"},"body":"Both top level and inline inner hits are now covered by InnerHitBuilder.\r\nAlthough there are differences between top level and inline inner hits,\r\nthey now make use of the same builder logic.\r\n\r\nThe parsing of top level inner hits slightly changed to be more readable.\r\nBefore the nested path or parent/child type had to be specified as encapsuting\r\njson object, now these settings are simple fields. Before this was required\r\nto allow streaming parsing of inner hits without missing contextual information.\r\n\r\nOnce some issues are fixed with inline inner hits (around multi level hierachy of inner hits),\r\ntop level inner hits will be deprecated and removed in the next major version.\r\n\r\nAlso I think some `SearchParseElement` implementations can be removed, but I haven't done that yet."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/201107105","html_url":"https://github.com/elastic/elasticsearch/pull/17291#issuecomment-201107105","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17291","id":201107105,"user":{"login":"dimfeld","id":1369558,"avatar_url":"https://avatars.githubusercontent.com/u/1369558?v=3","gravatar_id":"","url":"https://api.github.com/users/dimfeld","html_url":"https://github.com/dimfeld","followers_url":"https://api.github.com/users/dimfeld/followers","following_url":"https://api.github.com/users/dimfeld/following{/other_user}","gists_url":"https://api.github.com/users/dimfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/dimfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimfeld/subscriptions","organizations_url":"https://api.github.com/users/dimfeld/orgs","repos_url":"https://api.github.com/users/dimfeld/repos","events_url":"https://api.github.com/users/dimfeld/events{/privacy}","received_events_url":"https://api.github.com/users/dimfeld/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T01:59:22Z","updated_at":"2016-03-25T01:59:22Z","body":"With top-level `inner_hits` going away, is there a recommended way to replace the functionality? My usual case here involves using a `has_child` in the query to look for parents with a particular value in a child, and then a top-level `inner_hits` to return the top few child objects of the same type, ranked by some value using a `function_score`. \r\n\r\nI'm thinking that something like this will work; is there a better way?\r\n```\r\n{  query:  {  bool: {\r\n   must: // main query with \"real\" child filter and whatever else goes here\r\n   should: [\r\n      { has_child: { type: childType, inner_hits: {} }\r\n    ]\r\n} } } \r\n```"}}