Here's my script:
POST /_reindex
{
size: 1,
"source": {
"index": "roots_index0"
},
"dest": {
"index": "roots_index2"
},
"script" : { "inline": "ctx._source.id = rint(ctx._id)"}
}
I'm trying to store a numeric version of _id as id. I get the following error:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "failed to run inline script [ctx._source.id = rint(ctx._id)] using lang [groovy]"
}
],
"type": "script_exception",
"reason": "failed to run inline script [ctx._source.id = rint(ctx._id)] using lang [groovy]",
"caused_by": {
"type": "missing_method_exception",
"reason": "No signature of method: static java.lang.Math.rint() is applicable for argument types: (java.lang.String) values: [42361342]\nPossible solutions: rint(double), print(java.io.PrintWriter), print(java.lang.Object), find(), sin(double), sinh(double)"
}
},
"status": 500
}
Is there not a way to convert a string to a number? https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-scripting.html