# Index Structure for Nested Data

**URL:** https://discuss.elastic.co/t/index-structure-for-nested-data/21369
**Category:** Elasticsearch
**Created:** [December 23, 2014, 11:14am UTC](https://discuss.elastic.co/t/index-structure-for-nested-data/21369 "2014-12-23T11:14:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sameer\_Soni](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@Sameer\_Soni](https://discuss.elastic.co/u/Sameer_Soni)
#### Post date: [December 23, 2014, 11:14am UTC](https://discuss.elastic.co/t/index-structure-for-nested-data/21369/1 "2014-12-23T11:14:59Z")

</div>

Hi Guys,  
This question may have been asked before, but I couldn't find relevant  
answer so I am asking here.

I have a collection of Books, and each Book has contents composed in  
Chapters & Non-Chapters.  
I want to index these Books with contents and identify the content type, ie  
is it Chapter & Non-Chapter.  
Finally, for each query, I want to filter search results based on number of  
matching books, and each individual result should contain matching Chapter  
& Non-Chapter only.  
For example, always 10 matching books are returned, and each result has  
collection of matched Chapter & Non-Chapters.  
I identify each chapter and non-chapter by specific ids and they belong to  
a book which also has unique id.

Can somebody guide me as to how should I index my data, and construct  
query, so that most relevant results are returned.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/dd1434af-1018-43f3-8b20-a2813adae16a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dd1434af-1018-43f3-8b20-a2813adae16a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 12:42am UTC](https://discuss.elastic.co/t/index-structure-for-nested-data/21369/2 "2017-07-06T00:42:13Z")

</div>


