How to get Unique Parent record and its last child document?
This post has NOT been accepted by the mailing list yet.
I am trying to query elasticsearch in such a way the return the latest child document or any one child document for each unique parent document. I am indexing UserId as Parent document and User metadata information to child document. Each UserId will have multiple metadata info indexed as Child document. So I need to query to return top 1 child document for each UserId in Parent document. Can anyone help me on how to achieve this in Elasticsearch. I am using ES 5.1.