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