# Inheritance of mappings

**URL:** https://discuss.elastic.co/t/inheritance-of-mappings/12149
**Category:** Elasticsearch
**Created:** [May 28, 2013, 12:46pm UTC](https://discuss.elastic.co/t/inheritance-of-mappings/12149 "2013-05-28T12:46:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Bjoern\_Zapadlo](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@Bjoern\_Zapadlo](https://discuss.elastic.co/u/Bjoern_Zapadlo)
#### Post date: [May 28, 2013, 12:46pm UTC](https://discuss.elastic.co/t/inheritance-of-mappings/12149/1 "2013-05-28T12:46:19Z")

</div>

Hi,

is it possible to have kind of inheritance in a mapping. That means that  
properties in specific type are added to properties of default?

Examle:  
{  
"settings": {  
"mapper" : {  
"dynamic": false  
},  
"index": {  
"analysis": {  
"analyzer": {  
"string\_analyzer\_index": {  
"type": "custom",  
"tokenizer": "standard",  
"filter": ["asciifolding", "lowercase", "name\_ngram"]  
}  
},  
"filter": {  
"name\_ngram": {  
"type": "edgeNGram",  
"min\_gram": 1,  
"max\_gram": 20,  
"side": "front"  
}  
}  
}  
}  
},  
"mappings": {  
"_default_": {  
"properties": {  
"generalProperty01": {  
"type": "object"  
},  
"generalProperty02": {  
"type": "string"  
}  
},  
"dynamic\_templates": [  
{  
"name\_template": {  
"path\_match": "generalProperty01.\*",  
"mapping": {  
"type": "string",  
"include\_in\_all": false,  
"analyzer": "string\_analyzer\_index"  
}  
}  
]  
},  
"mySpecialEntity01": {  
"properties": {  
"specialEntity01Property01": {  
"type": "string"  
}  
}  
},  
"mySpecialEntity02": {  
}  
}  
}

Thanks in advance!  
Bjoern

--  
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: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [May 29, 2013, 6:14pm UTC](https://discuss.elastic.co/t/inheritance-of-mappings/12149/2 "2013-05-29T18:14:26Z")

</div>

I think your current solution of using dynamic templates and path matching  
is the only way to go, AFAIK.

--  
Ivan

On Tue, May 28, 2013 at 5:46 AM, Bjoern Zapadlo [bjoern.zapadlo@gmail.com](mailto:bjoern.zapadlo@gmail.com)wrote:

> Hi,
> 
> is it possible to have kind of inheritance in a mapping. That means that  
> properties in specific type are added to properties of default?
> 
> Examle:  
> {  
> "settings": {  
> "mapper" : {  
> "dynamic": false  
> },  
> "index": {  
> "analysis": {  
> "analyzer": {  
> "string\_analyzer\_index": {  
> "type": "custom",  
> "tokenizer": "standard",  
> "filter": ["asciifolding", "lowercase", "name\_ngram"]  
> }  
> },  
> "filter": {  
> "name\_ngram": {  
> "type": "edgeNGram",  
> "min\_gram": 1,  
> "max\_gram": 20,  
> "side": "front"  
> }  
> }  
> }  
> }  
> },  
> "mappings": {  
> "_default_": {  
> "properties": {  
> "generalProperty01": {  
> "type": "object"  
> },  
> "generalProperty02": {  
> "type": "string"  
> }  
> },  
> "dynamic\_templates": [  
> {  
> "name\_template": {  
> "path\_match": "generalProperty01.\*",  
> "mapping": {  
> "type": "string",  
> "include\_in\_all": false,  
> "analyzer": "string\_analyzer\_index"  
> }  
> }  
> ]  
> },  
> "mySpecialEntity01": {  
> "properties": {  
> "specialEntity01Property01": {  
> "type": "string"  
> }  
> }  
> },  
> "mySpecialEntity02": {  
> }  
> }  
> }
> 
> Thanks in advance!  
> Bjoern
> 
> --  
> 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).

--  
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:34am UTC](https://discuss.elastic.co/t/inheritance-of-mappings/12149/3 "2017-07-06T02:34:03Z")

</div>


