# What is the best schema design on one to many (1 to 10k) relationship mapping

**URL:** <https://discuss.elastic.co/t/what-is-the-best-schema-design-on-one-to-many-1-to-10k-relationship-mapping/26402>\
**Category:** Elasticsearch\
**Created:** [July 28, 2015, 9:23am UTC](https://discuss.elastic.co/t/what-is-the-best-schema-design-on-one-to-many-1-to-10k-relationship-mapping/26402 "2015-07-28T09:23:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haresh\_Patel](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Haresh\_Patel](https://discuss.elastic.co/u/Haresh_Patel)\
**Post date:** [July 28, 2015, 9:23am UTC](https://discuss.elastic.co/t/what-is-the-best-schema-design-on-one-to-many-1-to-10k-relationship-mapping/26402/1 "2015-07-28T09:23:39Z")

</div>

Hi,

I am facing problem and also I am new in ES. The problem is I have two entity, let's define X and Y.  
X entity have 10 field (key) and Y have 15 field (key).

X and Y have one to many relationship. the problem is one document have around 100 to 10k of many relationship of Y document.

I want to search from Y based on X and also search X based on Y entity.

Let's say X.fname , X.lname , X.blogtitle, and Y.comment, Y.commentatorName. (this is just example , I have 10 field in X and Y have 15 filed) I want to search on every field.

Can any one suggest me or help me which is best schema design for this scenario.

---

<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 5, 2017, 11:58pm UTC](https://discuss.elastic.co/t/what-is-the-best-schema-design-on-one-to-many-1-to-10k-relationship-mapping/26402/2 "2017-07-05T23:58:40Z")

</div>


