Delete bulk documents using Java SDK

What is the best way to delete documents as high as 5 million using Java SDK ? Is simply running a N1QL to delete all 5 million records in one go a good idea ? How can batching be achieved using Java sdk ? Also need to determine the doc ids which got successfully deleted and the ones which didnt.

Couchbase server version : 4.1