# Error while reindexing data: Mixing up field types \[ ES version 5.4.3 \]

**URL:** <https://discuss.elastic.co/t/error-while-reindexing-data-mixing-up-field-types-es-version-5-4-3/217142>\
**Category:** Elasticsearch\
**Created:** [January 30, 2020, 9:41am UTC](https://discuss.elastic.co/t/error-while-reindexing-data-mixing-up-field-types-es-version-5-4-3/217142 "2020-01-30T09:41:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwani2797](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashwani2797/32/61635_2.png) [@ashwani2797](https://discuss.elastic.co/u/ashwani2797)\
**Post date:** [January 30, 2020, 9:41am UTC](https://discuss.elastic.co/t/error-while-reindexing-data-mixing-up-field-types-es-version-5-4-3/217142/1 "2020-01-30T09:41:58Z")

</div>

Hi Team,

I am reindexing data because the required change type of field, but during reindexing, I got the error.

_Mixing up field types: class org.elasticsearch.index.mapper.KeywordFieldMapper$KeywordFieldType != class org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType on field payment.additionalParams_

This additionalParams type is "Text" in both old and new mappings.  
Its contains the stringify JSON:  
For example:

additionalParams": "{"CURRENCY":"INR","redirectUrl":"9c2e1f025773c41e2c58a4ec5837efe8dfc5a43d1ea5c3105291017f8ac26c2b776ce7f6ccb5af7218bc678e6f5a19b4083ff5b1c157bdf650e5cd734a6e3663ba9286cd0d5706f986bfb3f13486536ca4b53bef50c4f106cde24aef67cb2986","RESPMSG":"User has not completed transaction.","orderId":"1580295987504","MID":"NoBrok64803316911648","MERC\_UNQ\_REF":"7009030043\_ff8081815a701e88015a7f4d06d203a6","RESPCODE":"141","TXNID":"20200129111212800110168616311417623","TXNAMOUNT":"10.00","hashValue":"OIxc5Msu2Qu9OBgxuO/RuzwCggNLiwJxxmy20pK3nergGodbrQXmUHwH7Tj16cMy8sptfhrhowKI/7JtXrAFaApGO+kCLuxqVb1itR0bUo0=","ORDERID":"1580295987504","STATUS":"TXN\_FAILURE","BANKTXNID":"","pg":"PAYTM","CHECKSUMHASH":"lhCBMehDWysjQRctb3z9m5Y82Ja+AoF5Ap7dekW/Ru9KYVDZhoYiOFLaQWQM3Mxntyub+i/Nu3NgBm6Nkw2SMYiFgA9jUuh2xdRMwNglsE8="}",

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 30, 2020, 2:35pm UTC](https://discuss.elastic.co/t/error-while-reindexing-data-mixing-up-field-types-es-version-5-4-3/217142/2 "2020-01-30T14:35:53Z")

</div>

This looks as if you are trying to update the mapping of an existing index instead of creating a new index and index into that one.

Can you explain the whole process more detailed?

---

<div class="post-metadata">

**Author:** ![ashwani2797](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashwani2797/32/61635_2.png) [@ashwani2797](https://discuss.elastic.co/u/ashwani2797)\
**Post date:** [February 3, 2020, 6:59am UTC](https://discuss.elastic.co/t/error-while-reindexing-data-mixing-up-field-types-es-version-5-4-3/217142/3 "2020-02-03T06:59:04Z")

</div>

Yes sure. Thanks for the reply.

I am trying to reindex data from my old index to the new index because I changed the type of one field.  
**Below is the mapping of old index:**  
`curl -s -XPUT localhost:8200/rent\_payment' -d '{  
"mappings": {  
"_default_": {  
"\_all": {  
"enabled": true  
},  
"dynamic\_templates": [  
{  
"strings": {  
"match\_mapping\_type": "string",  
"mapping": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
},  
{  
"dates": {  
"match": ".\*Date|date",  
"match\_pattern": "regex",  
"mapping": {  
"type": "date"  
}  
}  
}  
]  
}  
}  
}'

curl -H 'Content-Type: application/json' -s -XPUT 'localhost:8200/rent\_payment/\_mapping/rent\_payment' -d '{  
"properties": {  
"payment.additionalParams": {  
"type": "text"  
},  
"relationship.tenant.address": {  
"type": "text"  
},  
"relationship.owner.address": {  
"type": "text"  
},  
"relationship.owner.phone": {  
"type": "text"  
},  
"relationship.tenant.phone": {  
"type": "text"  
},  
"transaction.payout.additionalParams": {  
"type": "text"  
},  
"transaction.payout.beneficiaryName": {  
"type": "text"  
},  
"transaction.payout.beneficiaryPhone": {  
"type": "text"  
},  
"transaction.payout.createdOn": {  
"type": "date"  
},  
"transaction.lastUpdateDate": {  
"type": "date"  
},  
"payment.lastUpdateDate": {  
"type": "date"  
}  
}  
}'

**And my new index mapping is:**

```
curl -s -XPUT 'localhost:8200/rent_payment_v1' -d '{

```

"mappings": {  
"_default_": {  
"\_all": {  
"enabled": true  
},  
"dynamic\_templates": [  
{  
"strings": {  
"match\_mapping\_type": "string",  
"mapping": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
},  
{  
"dates": {  
"match": ".\*Date|date",  
"match\_pattern": "regex",  
"mapping": {  
"type": "date"  
}  
}  
}  
]  
}  
}  
}'

curl -H 'Content-Type: application/json' -s -XPUT 'localhost:8200/rent\_payment\_v1/\_mapping/rent\_payment' -d '{  
"properties": {  
"payment.additionalParams": {  
"type": "text"  
},"payment.status": {  
"type": "text",  
"fields": {  
"raw": {  
"type":"keyword"   
}   
}  
},  
"relationship.tenant.address": {  
"type": "text"  
},  
"relationship.owner.address": {  
"type": "text"  
},  
"relationship.owner.phone": {  
"type": "text"  
},  
"relationship.tenant.phone": {  
"type": "text"  
},  
"transaction.payout.additionalParams": {  
"type": "text"  
},  
"transaction.payout.beneficiaryName": {  
"type": "text"  
},  
"transaction.payout.beneficiaryPhone": {  
"type": "text"  
},  
"transaction.payout.createdOn": {  
"type": "date"  
},  
"transaction.lastUpdateDate": {  
"type": "date"  
}  
}  
}'

**And just change in mapping is I added payment.status mapping manually**.  
While doing so. There is one more column param.additionalParams which has same type in old and new index.  
**The main catch is this field contains the stringify JSON data.**

```
POST _reindex

```

{  
"source": {  
"index": "rent\_payment"  
},  
"dest": {  
"index": "rent\_payment\_v1"  
}  
}

After running this command, I got the error on the first row itself:  
_Mixing up field types: class org.elasticsearch.index.mapper.KeywordFieldMapper$KeywordFieldType != class org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType on field payment.additionalParams_

---

<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:** [March 2, 2020, 6:59am UTC](https://discuss.elastic.co/t/error-while-reindexing-data-mixing-up-field-types-es-version-5-4-3/217142/4 "2020-03-02T06:59:05Z")

</div>

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