Painless Script to Concat in ReIndex API

I am trying to concat 2 fields using painless script during ReIndex API call. However not able to get the correct syntax.

field3=field1,field2. The below code is throwing a parsing exception

    POST _reindex
{
  "source": {
    "index": "sourceIdx",
    "type": "sourxeType"
  },
  "dest": {
    "index": "destinationIdx"
    
  },
  "script": {
    "source": "ctx._source.field3=
    ctx._source.field1 + ',' +  ctx._source.field2",
    "lang": "painless"
  }
}

Can you please show what the exception is being thrown? At a glance, it looks like you have a newline in your string script, which is not allowed by json.

I got this working. I was not doing a null or empty check for "field1" and "field2" before assigning the value to "field3"