# MapperParsingException trying to define an index template

**URL:** https://discuss.elastic.co/t/mapperparsingexception-trying-to-define-an-index-template/18575
**Category:** Elasticsearch
**Created:** [July 10, 2014, 11:32am UTC](https://discuss.elastic.co/t/mapperparsingexception-trying-to-define-an-index-template/18575 "2014-07-10T11:32:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Edem\_Morny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/edem_morny/32/1413_2.png) [@Edem\_Morny](https://discuss.elastic.co/u/Edem_Morny)
#### Post date: [July 10, 2014, 11:32am UTC](https://discuss.elastic.co/t/mapperparsingexception-trying-to-define-an-index-template/18575/1 "2014-07-10T11:32:49Z")

</div>

Hi,  
I'm using Elasticsearch 1.2.1, and attempting to define an index template  
that should prevent the analysis of certain ID fields in our datamodel,  
whiles allowing everything else to be analyzed. I've created a template  
json file and put it in the config/templates directory.

Here is my template json file  
{  
"carewex\_template": {  
"template": "\*",  
"settings": {  
"index.number\_of\_shards": 2  
},  
"mappings": {  
"_default_": {  
"\_all": {  
"enabled": false  
},  
"type": "{dynamic\_type}",  
"index": "analyzed",  
"fields": {  
"id": {"type": "{dynamic\_type}", "index":  
"not\_analyzed"},  
"productId": {"type": "{dynamic\_type}", "index":  
"not\_analyzed"},  
"facilityId": {"type": "{dynamic\_type}", "index":  
"not\_analyzed"},  
"departmentId": {"type": "{dynamic\_type}", "index":  
"not\_analyzed"},  
"patientId": {"type": "{dynamic\_type}", "index":  
"not\_analyzed"},  
"secondaryId": {"type": "{dynamic\_type}", "index":  
"not\_analyzed"}  
}

```
        }
    }
}

```

}

However when I try to index, I get the following exception.

Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root type  
mapping not empty after parsing! Remaining fields: [index : analyzed] [type  
: {dynamic\_type}] [fields : {secondaryId={index=not\_analyzed,  
type={dynamic\_type}}, id={index=not\_analyzed, type={dynamic\_type}},  
patientId={index=not\_analyzed, type={dynamic\_type}},  
departmentId={index=not\_analyzed, type={dynamic\_type}},  
facilityId={index=not\_analyzed, type={dynamic\_type}},  
productId={index=not\_analyzed, type={dynamic\_type}}}]

Any ideas on what do do about this?

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/36afc803-0c92-42f8-b2f8-e9ba01ce4a69%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/36afc803-0c92-42f8-b2f8-e9ba01ce4a69%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:16am UTC](https://discuss.elastic.co/t/mapperparsingexception-trying-to-define-an-index-template/18575/2 "2017-07-06T01:16:50Z")

</div>


