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

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="}",

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?

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

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