# Nested type

**URL:** <https://discuss.elastic.co/t/nested-type/11428>\
**Category:** Elasticsearch\
**Created:** [April 3, 2013, 11:17am UTC](https://discuss.elastic.co/t/nested-type/11428 "2013-04-03T11:17:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [April 3, 2013, 11:17am UTC](https://discuss.elastic.co/t/nested-type/11428/1 "2013-04-03T11:17:57Z")

</div>

I am planning to use nested type.Do let me know the solutions for below ones

1. Does Elastic search support variable length nested type? i.e. Suppose I  
want to allow different levels of nesting of objects. Like one document can  
have just the child and the other document may have child and grandchild  
and so on... I may not be able to decide the depth of descendants before in  
hand
2. If I have a reference (document id) of the other document stored in  
a different shard, Is there any builtin cross reference technique available  
in elastic search
3. Does the nested type impose any performance overhead (speed) while  
indexing and as well as in searching compared to flat storage?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [April 3, 2013, 2:02pm UTC](https://discuss.elastic.co/t/nested-type/11428/2 "2013-04-03T14:02:23Z")

</div>

1. Yes, you can have multiple level on nested inner objects. If you add a  
new layer of nested object level, just make sure you update the mapping  
before you add docs that have inner objects on hat nested object level.
2. I'm not sure how this relates to nested field type. All nested objects  
are put into the same root document and therefor are on the same shard. Do  
you mean parent / child?
3. The nested field type has almost no extra overhead over during indexing  
/ searching. If you have documents with many inner nested objects it has  
basically the same overhead as documents with many fields.

On 3 April 2013 13:17, Chetana [ambha.career@gmail.com](mailto:ambha.career@gmail.com) wrote:

> I am planning to use nested type.Do let me know the solutions for below  
> ones
> 
> 1. Does Elastic search support variable length nested type? i.e. Suppose I  
> want to allow different levels of nesting of objects. Like one document can  
> have just the child and the other document may have child and grandchild  
> and so on... I may not be able to decide the depth of descendants before in  
> hand
> 2. If I have a reference (document id) of the other document stored in  
> a different shard, Is there any builtin cross reference technique available  
> in Elasticsearch
> 3. Does the nested type impose any performance overhead (speed) while  
> indexing and as well as in searching compared to flat storage?
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [April 4, 2013, 3:10am UTC](https://discuss.elastic.co/t/nested-type/11428/3 "2013-04-04T03:10:04Z")

</div>

Thanks for your answer.  
As you said second question need not be for nested type.

On Wednesday, April 3, 2013 7:32:23 PM UTC+5:30, Martijn v Groningen wrote:

> 1. Yes, you can have multiple level on nested inner objects. If you add a  
> new layer of nested object level, just make sure you update the mapping  
> before you add docs that have inner objects on hat nested object level.
> 2. I'm not sure how this relates to nested field type. All nested objects  
> are put into the same root document and therefor are on the same shard. Do  
> you mean parent / child?
> 3. The nested field type has almost no extra overhead over during indexing  
> / searching. If you have documents with many inner nested objects it has  
> basically the same overhead as documents with many fields.
> 
> On 3 April 2013 13:17, Chetana \<[ambha....@gmail.com](mailto:ambha....@gmail.com) \<javascript:\>\> wrote:
> 
> > I am planning to use nested type.Do let me know the solutions for below  
> > ones
> > 
> > 1. Does Elastic search support variable length nested type? i.e. Suppose  
> > I want to allow different levels of nesting of objects. Like one document  
> > can have just the child and the other document may have child and  
> > grandchild and so on... I may not be able to decide the depth of  
> > descendants before in hand
> > 2. If I have a reference (document id) of the other document stored in  
> > a different shard, Is there any builtin cross reference technique available  
> > in Elasticsearch
> > 3. Does the nested type impose any performance overhead (speed) while  
> > indexing and as well as in searching compared to flat storage?
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:42am UTC](https://discuss.elastic.co/t/nested-type/11428/4 "2017-07-06T02:42:54Z")

</div>


