Reputation: 5
I have a document with nested types and I use nested query to search on the nested part. Now I get a hit and the search result returned is the whole doc. Could anyone tell me how can I get only this nested part or the part of document which contains this nested part? Should I use parent-child? Or using nested types can also meet my requirement? Thanks!
Upvotes: 0
Views: 79
Reputation: 60205
With nested documents you can only get back the whole structure (parent + all children) and you can only update the whole structure.
If you switch to parent/child you can index parent and every child independently paying the price of more memory usage and a little worse performance. On the other hand this way you can search on the parents and get back the children, or search on the children and get back the parents.
Also, children are separate documents and you can index query them independently, regardless of the fact that they have a parent.
Upvotes: 1