Hi David
I looked up some ways to change mapping types but it seemed all would require me to delete my index and re-import everything.
I have just finished a process whereby I ran:
POST /my_index/_update_by_query?wait_for_completion=false&conflicts=proceed
{
"query": {
"regexp":{
"number": "[0-9]{4}"
}
},
"script": {
"lang": "painless",
"source": "ctx._source.number_int = Integer.parseInt(ctx._source.number)"
}
}
Which worked to add a new field to every record. I first tested by using a restrictive query block to check one ID at a time. When I tried to run with no query I got script errors; I couldn't work out why as it suggested some fields were blank, but searching for or eliminating these did not work. In the end the regex worked to prevent errors, and the task took about an hour to do 30m records, with relatively little impact to the system performance (though the system is not under production load yet).