# Nested document

**URL:** <https://discuss.elastic.co/t/nested-document/7682>\
**Category:** Elasticsearch\
**Created:** [May 14, 2012, 12:08pm UTC](https://discuss.elastic.co/t/nested-document/7682 "2012-05-14T12:08:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nmz/32/2842_2.png) [@nmz](https://discuss.elastic.co/u/nmz)\
**Post date:** [May 14, 2012, 12:08pm UTC](https://discuss.elastic.co/t/nested-document/7682/1 "2012-05-14T12:08:07Z")

</div>

Hi,

I try to create 'test' document as follows

{  
"test": {  
"properties": {  
"nested\_docs": {  
"properties": {  
"user\_id": { "type": "string", "index":  
"not\_analyzed" },  
"user\_name" :{................}  
"created\_time": { "type": "date" }  
}  
}  
} } }

I have a field 'nested\_docs' [multi-valued] which has two fields  
[user\_id, created\_time].

Will this document mapping automatically be nested type, or do I have  
to specify "type": "nested" ?

Also i would like to know about the advantage of using nested  
documents.

---

<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, 3:28am UTC](https://discuss.elastic.co/t/nested-document/7682/2 "2017-07-06T03:28:59Z")

</div>


