I'm trying to remove data.properties.review_meta
field because it's causing trouble
POST /_reindex
{
"source": {
"index": "analytics-prod-2020.11.05"
},
"dest": {
"index": "analytics-prod-2020.11.05.02"
},
"conflicts": "proceed",
"script" : {
"source": "ctx._source.data.remove('properties.review_meta')"
}
}
code doesn't work with the error message
"failures" : [
{
"index" : "analytics-prod-2020.11.05.02",
"type" : "_doc",
"id" : "gksugnUBaMafnb1n2Iqy",
"cause" : {
"type" : "mapper_parsing_exception",
"reason" : "object mapping for [data.properties.review_meta] tried to parse field [review_meta] as object, but found a concrete value"
},
"status" : 400
},
{
"index" : "analytics-prod-2020.11.05.02",
"type" : "_doc",
"id" : "jUsvgnUBaMafnb1nsrkC",
"cause" : {
"type" : "mapper_parsing_exception",
"reason" : "object mapping for [data.properties.review_meta] tried to parse field [review_meta] as object, but found a concrete value"
},
"status" : 400
}
]
source index(2020.11.05) has
"review_meta" : {
"type" : "long"
},
dest index(2020.11.05.02) has index template
{
"review_meta" : {
"match" : "review_meta",
"mapping" : {
"type" : "object"
}
}
}
Your script should be like this instead and then it will work:
ctx._source.data.properties.remove('review_meta')