Copy String field to new Integer Field gives error

I have a keyword field that it should be a numeric instead. To avoid reindexing all my data I created a new field with the right numeric mapping. I would like to add the old data to the new mapping
I am trying this

POST index-00004/_update_by_query
  "script": {
    "source": "ctx._source['log.numeric.duration']=ctx._source['log.values.duration']",
    "lang": "painless"
  "query": {
    "exists": {
      "field": "log.values.duration"

The problem is I get this error

  "failures" : [
      "index" : "index-00004",
      "type" : "_doc",
      "id" : "IaoKMnwB10PZ-PXKMS01",
      "cause" : {
        "type" : "version_conflict_engine_exception",
        "reason" : "[IaoKMnwB10PZ-PXKMS01]: version conflict, required seqNo [739121], primary term [1]. current document has seqNo [10651181] and primary term [1]",
        "index_uuid" : "fPuIF4R1SmGR03MtHG3V0A",
        "shard" : "1",
        "index" : "index-00004"
      "status" : 409

I thought I would parse the string to int but it gives me another error

  "script": {
    "source": "ctx._source['log.values.duration']=Integer.parseInt(ctx._source['log.coflowco.num.duration'].value)",

It gives error:

        "script_stack" : [
          "                                                                                              ^---- HERE"

Any other ideas??

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.