I have an index with wrong datatype in an attribute "vjid"
I tried to convert "vjid" values from string to integer using this command:
POST vjdb/_update_by_query
{
"script": {
"source": "ctx._source.vjid = Integer.parseInt(ctx._source.vjid)",
"lang": "painless"
},
"query": {
"exists": {
"field": "vjid"
}
}
}
it works perfectly but suddenly stops after tens of seconds with this message:
{
"statusCode": 502,
"error": "Bad Gateway",
"message": "Client request timeout"
}
this is the input content of the index:
"hits": [
{
"_index": "vjdb",
"_id": "uGhUGI8ByGfsded-LttS",
"_score": 1,
"_source": {
"vjid": "12575001"
}
},
{
"_index": "vjdb",
"_id": "uWhUGI8ByGfsded-LttS",
"_score": 1,
"_source": {
"vjid": "12575271"
}
},...
and this is the correct output of the script:
"hits": [
{
"_index": "vjdb",
"_id": "uGhUGI8ByGfsded-LttS",
"_score": 1,
"_source": {
"vjid": 12575001
}
},
{
"_index": "vjdb",
"_id": "uWhUGI8ByGfsded-LttS",
"_score": 1,
"_source": {
"vjid": 12575271
}
},...
the output shows it is working nicely for the first 10K but at some point it terminated and the rest of the data is not converted.
I tried to slice the input or increase the timeout but all failed. Do you know any successful method to convert all 20 million records with this code?