{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/11118","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11118/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11118/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11118/events","html_url":"https://github.com/elastic/elasticsearch/issues/11118","id":75601121,"number":11118,"title":"has_child and inner_hits for grandchild hit","user":{"login":"lukens","id":686128,"avatar_url":"https://avatars.githubusercontent.com/u/686128?v=3","gravatar_id":"","url":"https://api.github.com/users/lukens","html_url":"https://github.com/lukens","followers_url":"https://api.github.com/users/lukens/followers","following_url":"https://api.github.com/users/lukens/following{/other_user}","gists_url":"https://api.github.com/users/lukens/gists{/gist_id}","starred_url":"https://api.github.com/users/lukens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukens/subscriptions","organizations_url":"https://api.github.com/users/lukens/orgs","repos_url":"https://api.github.com/users/lukens/repos","events_url":"https://api.github.com/users/lukens/events{/privacy}","received_events_url":"https://api.github.com/users/lukens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-12T13:25:49Z","updated_at":"2015-05-12T14:12:57Z","closed_at":null,"body":"I'm trying to get `inner_hits` to work on an a two level deep `has_child` query, but the grandchild hits just seem to return an empty array.  If I specify the inner hits at the top level I get the results I want, but its rather too slow. Using inner hits on the has child query seems much faster, but doesn't return the grandchild hits.\r\n\r\nBelow is an example query:\r\n\r\n```json\r\n{\r\n  \"from\" : 0,\r\n  \"size\" : 25,\r\n  \"query\" : {\r\n    \"has_child\" : {\r\n      \"query\" : {\r\n        \"has_child\" : {\r\n          \"query\" : {\r\n            \"filtered\" : {\r\n              \"query\" : {\r\n                \"multi_match\" : {\r\n                  \"query\" : \"asia\",\r\n                  \"fields\" : [ \"_search\" ],\r\n                  \"operator\" : \"AND\",\r\n                  \"analyzer\" : \"library_synonyms\",\r\n                  \"fuzziness\" : \"1\"\r\n                }\r\n              },\r\n              \"filter\" : {\r\n                \"and\" : {\r\n                  \"filters\" : [ {\r\n                    \"terms\" : {\r\n                      \"range\" : [ \"Global\" ]\r\n                    }\r\n                  } ]\r\n                }\r\n              }\r\n            }\r\n          },\r\n          \"child_type\" : \"document-ref\",\r\n          \"inner_hits\" : {\r\n            \"name\" : \"document-ref\"\r\n          }\r\n        }\r\n      },\r\n      \"child_type\" : \"class\",\r\n      \"inner_hits\" : {\r\n        \"size\" : 1000,\r\n        \"_source\" : false,\r\n        \"fielddata_fields\" : [ \"class\" ],\r\n        \"name\" : \"class\"\r\n      }\r\n    }\r\n  },\r\n  \"fielddata_fields\" : [ \"name\" ]\r\n}\r\n```\r\n\r\nThe `document-ref` inner hits just always returns an empty array.  Should this work (and, if so, any ideas why it isn't?), or is it beyond the means of what inner hits can currently do?"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/101296674","html_url":"https://github.com/elastic/elasticsearch/issues/11118#issuecomment-101296674","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11118","id":101296674,"user":{"login":"lukens","id":686128,"avatar_url":"https://avatars.githubusercontent.com/u/686128?v=3","gravatar_id":"","url":"https://api.github.com/users/lukens","html_url":"https://github.com/lukens","followers_url":"https://api.github.com/users/lukens/followers","following_url":"https://api.github.com/users/lukens/following{/other_user}","gists_url":"https://api.github.com/users/lukens/gists{/gist_id}","starred_url":"https://api.github.com/users/lukens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukens/subscriptions","organizations_url":"https://api.github.com/users/lukens/orgs","repos_url":"https://api.github.com/users/lukens/repos","events_url":"https://api.github.com/users/lukens/events{/privacy}","received_events_url":"https://api.github.com/users/lukens/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T14:12:57Z","updated_at":"2015-05-12T14:12:57Z","body":"[I'm using 1.5.2]"}}