I am trying to migrate from ES 1.4 to ES 5.5. In one of the index I need to change the name of field and also convert it's value to uppercase. I am able to reindex with change in name of field and remove the unwanted field but need help in converting the value to uppercase.
This is what I tried
POST _reindex?wait_for_completion=false
{
  "source": {
	"remote": {
	  "host": "http://source_ip:17002"
	},
	"index": "log_event_2017-09-11",
	"size": 1000,
	"query": {
	  "match_all": {}
	}
  },
  "dest": {
	"index": "logs-ics-2017-09-11"
  },
  "script": {
	"inline": "ctx._source.product = ctx._source.remove(\"product_name\")",
	"lang": "painless"
  }
}
The above POST request is able to remove "product_name" and create "product" with it's value. So in order to uppercase "product" value I tried below inline script but it gives a null_pointer_exception. Please help
"ctx._source.product = ctx._source.remove(\"product_name\");ctx._source.product = doc[\"product\"].toUpperCase()"