{"action":"closed","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/16582","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16582/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16582/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16582/events","html_url":"https://github.com/elastic/elasticsearch/issues/16582","id":132718940,"number":16582,"title":"inner_hits empty if null objects exist in path","user":{"login":"abulhol","id":4851778,"avatar_url":"https://avatars.githubusercontent.com/u/4851778?v=3","gravatar_id":"","url":"https://api.github.com/users/abulhol","html_url":"https://github.com/abulhol","followers_url":"https://api.github.com/users/abulhol/followers","following_url":"https://api.github.com/users/abulhol/following{/other_user}","gists_url":"https://api.github.com/users/abulhol/gists{/gist_id}","starred_url":"https://api.github.com/users/abulhol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abulhol/subscriptions","organizations_url":"https://api.github.com/users/abulhol/orgs","repos_url":"https://api.github.com/users/abulhol/repos","events_url":"https://api.github.com/users/abulhol/events{/privacy}","received_events_url":"https://api.github.com/users/abulhol/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-10T14:51:16Z","updated_at":"2016-02-12T16:56:00Z","closed_at":"2016-02-12T16:56:00Z","body":"I use top level inner hits to retrieve data from multiple nested documents. \r\nElasticsearch returns empty inner hits arrays for some of the hits, which is probably due to the existence of null objects inside the nested documents. \r\nPlease see a detailed description of the problem in this forum entry:\r\n[https://discuss.elastic.co/t/nested-query-missing-inner-hits/41038](url)\r\nI have looked at these documents with jq like this:\r\n` jq .a.b.c.d.first[].e.f.second[].message<json>`\r\nand the output is e.g. like this:\r\n```\r\n\"Some message\"\r\n\"Some other message\"\r\njq: error: Cannot iterate over null\r\n```\r\nSo I believe Elasticsearch iterates over the nested documents in a similar way and returns null if any of the nested objects is null (?). \r\nI guess the ES code needs to be fixed then? "}}