N1QL CBQ Update million records is not working

As @vsr1 indicated Eventing can provide a high performance solution:

I addition I would encourage you to look at Function: fixEmailDomains | Couchbase Docs it should be close to the exact Eventing code that you are looking for.