# Same name fields in two mappings disable indexing in one mapping

**URL:** <https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560>\
**Category:** Elasticsearch\
**Created:** [May 4, 2018, 5:12am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560 "2018-05-04T05:12:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yogesh\_BG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_bg/32/70018_2.png) [@Yogesh\_BG](https://discuss.elastic.co/u/Yogesh_BG)\
**Post date:** [May 4, 2018, 5:12am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/1 "2018-05-04T05:12:15Z")

</div>

Hi

I have two mappings, mapping1 and mapping2... mapping1 goes to index1 and mapping2 to index2.

But mapping1 and mapping2 are same. Want to enable index in mapping1 and disable in mapping2.

How to do this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 4, 2018, 5:29am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/2 "2018-05-04T05:29:03Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

---

<div class="post-metadata">

**Author:** ![Yogesh\_BG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_bg/32/70018_2.png) [@Yogesh\_BG](https://discuss.elastic.co/u/Yogesh_BG)\
**Post date:** [May 4, 2018, 5:58am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/3 "2018-05-04T05:58:51Z")

</div>

These are the two mappings goes into two indices

> Blockquote  
> {  
> "template": "\*-accesslog",  
> "order": 10,  
> "mappings": {  
> "accesslog1": {  
> "\_all": {  
> "enabled": false  
> },  
> "properties": {  
> "accountId": {  
> "type": "string",  
> "index\_options": "docs",  
> "norms": {  
> "enabled": false  
> },  
> "index": "not\_analyzed"  
> },  
> "applicationId": {  
> "type": "string",  
> "index\_options": "docs",  
> "norms": {  
> "enabled": false  
> },  
> "index": "not\_analyzed"  
> },  
> "requestSize": {  
> "type": "long",  
> "doc\_values": false,  
> "norms": {  
> "enabled": false  
> },  
> "index": "no"  
> },  
> "requestStartTime": {  
> "type": "long",  
> "doc\_values": false,  
> "norms": {  
> "enabled": false  
> },  
> "index": "no"  
> },  
> "requestEndTime": {  
> "type": "long",  
> "doc\_values": false,  
> "norms": {  
> "enabled": false  
> },  
> "index": "no"  
> }  
> }  
> }

> Blockquote  
> {  
> "template": "thunder-\*",  
> "order": 10,  
> "mappings": {  
> "accesslog2": {  
> "\_all": {  
> "enabled": false  
> },  
> "properties": {  
> "accountId": {  
> "type": "string",  
> "doc\_values": true,  
> "index": "not\_analyzed"  
> },  
> "applicationId": {  
> "type": "string",  
> "doc\_values": true,  
> "index": "not\_analyzed"  
> },  
> "requestSize": {  
> "type": "long",  
> "doc\_values": true,  
> "index": "not\_analyzed"  
> },  
> "requestStartTime": {  
> "type": "long",  
> "doc\_values": true,  
> "index": "not\_analyzed"  
> },  
> "requestEndTime": {  
> "type": "long",  
> "doc\_values": true,  
> "index": "not\_analyzed"  
> }  
> }  
> }  
> }  
> }  
> "

here thogh they are different indices, when i post the record i get the exception saying fields with same name has different index option in another index. Can you help me how can i put analyzer to be different so that they dont collide?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 4, 2018, 6:01am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/4 "2018-05-04T06:01:10Z")

</div>

The index templates have the same order and one is using a suffix while the other one is using a prefix to match the indices to apply to. What is the name of your index that is causing the problem?

---

<div class="post-metadata">

**Author:** ![Yogesh\_BG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_bg/32/70018_2.png) [@Yogesh\_BG](https://discuss.elastic.co/u/Yogesh_BG)\
**Post date:** [May 4, 2018, 6:27am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/5 "2018-05-04T06:27:20Z")

</div>

> [@Yogesh\_BG](#):
>
> requestSize

has the same name same type, but value for index is different not\_analyzed and no

this is causing the problem... in one index i want to disable and in another i want to enable

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 4, 2018, 6:28am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/6 "2018-05-04T06:28:44Z")

</div>

What is the name of the indices? When are you getting problems, when indexing or querying?

---

<div class="post-metadata">

**Author:** ![Yogesh\_BG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_bg/32/70018_2.png) [@Yogesh\_BG](https://discuss.elastic.co/u/Yogesh_BG)\
**Post date:** [May 4, 2018, 7:18am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/7 "2018-05-04T07:18:09Z")

</div>

i am getting problem when indexing

index1 - agsjh-4njbn-j333-accesslog  
index2 - thunder-agsjh-4njbn-j333

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 4, 2018, 7:58am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/8 "2018-05-04T07:58:57Z")

</div>

Can you show the exact error you are getting?

---

<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:** [June 1, 2018, 7:59am UTC](https://discuss.elastic.co/t/same-name-fields-in-two-mappings-disable-indexing-in-one-mapping/130560/9 "2018-06-01T07:59:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
