# Specify type in mapping for nested documents

**URL:** <https://discuss.elastic.co/t/specify-type-in-mapping-for-nested-documents/14312>\
**Category:** Elasticsearch\
**Created:** [November 8, 2013, 12:00am UTC](https://discuss.elastic.co/t/specify-type-in-mapping-for-nested-documents/14312 "2013-11-08T00:00:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Blado](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@David\_Blado](https://discuss.elastic.co/u/David_Blado)\
**Post date:** [November 8, 2013, 12:00am UTC](https://discuss.elastic.co/t/specify-type-in-mapping-for-nested-documents/14312/1 "2013-11-08T00:00:29Z")

</div>

i'm experimenting w/ the nested mapping type and am looking a lots of  
examples / blog posts and not seeing any way to specify core types for the  
fields in nested documents -- am I missing something or is this not  
possible?

Cheers,

David

--  
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:** ![sina\_tamanna](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@sina\_tamanna](https://discuss.elastic.co/u/sina_tamanna)\
**Post date:** [November 8, 2013, 8:09am UTC](https://discuss.elastic.co/t/specify-type-in-mapping-for-nested-documents/14312/2 "2013-11-08T08:09:44Z")

</div>

You can use core types in nested fields of course. Here is an example that  
hopefully will clear-up things:

"mappings": {  
"my\_index": {  
"properties": {  
"attributes": {  
"type": "nested",  
"dynamic": "false",  
"properties": {  
"attribute\_id": {  
"type": "long"  
},  
"attribute\_name": {  
"type": "string"  
},  
"attribute\_values": {  
"type": "string"  
}  
}  
}  
}  
}  
}

and notice that dynamic flag is set to false so no other extra field would  
be added to the attributes field.

On Friday, November 8, 2013 1:00:29 AM UTC+1, David Blado wrote:

> i'm experimenting w/ the nested mapping type and am looking a lots of  
> examples / blog posts and not seeing any way to specify core types for the  
> fields in nested documents -- am I missing something or is this not  
> possible?
> 
> Cheers,
> 
> David

--  
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:** ![David\_Blado](https://avatars.discourse-cdn.com/v4/letter/d/958977/32.png) [@David\_Blado](https://discuss.elastic.co/u/David_Blado)\
**Post date:** [November 8, 2013, 4:08pm UTC](https://discuss.elastic.co/t/specify-type-in-mapping-for-nested-documents/14312/3 "2013-11-08T16:08:41Z")

</div>

Thanks Sina

That's exactly what I was looking for!  
On Nov 8, 2013 12:10 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:

> You can use core types in nested fields of course. Here is an example that  
> hopefully will clear-up things:
> 
> "mappings": {  
> "my\_index": {  
> "properties": {  
> "attributes": {  
> "type": "nested",  
> "dynamic": "false",  
> "properties": {  
> "attribute\_id": {  
> "type": "long"  
> },  
> "attribute\_name": {  
> "type": "string"  
> },  
> "attribute\_values": {  
> "type": "string"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> and notice that dynamic flag is set to false so no other extra field  
> would be added to the attributes field.
> 
> On Friday, November 8, 2013 1:00:29 AM UTC+1, David Blado wrote:
> 
> > i'm experimenting w/ the nested mapping type and am looking a lots of  
> > examples / blog posts and not seeing any way to specify core types for the  
> > fields in nested documents -- am I missing something or is this not  
> > possible?
> > 
> > Cheers,
> > 
> > David
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/qSNMLYVLyos/unsubscribe](https://groups.google.com/d/topic/elasticsearch/qSNMLYVLyos/unsubscribe).  
> To unsubscribe from this group and all its topics, 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).

--  
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:08am UTC](https://discuss.elastic.co/t/specify-type-in-mapping-for-nested-documents/14312/4 "2017-07-06T02:08:07Z")

</div>


