"Required array length too large" error during reindex

I'm in the process of reindexing an index of large nested documents. During the reindex I'm using painless script to pull a couple nested documents up a level. For the most part the reindex is going fine but occasionally I'm getting a "java.lang.OutOfMemoryError: Required array length too large" which results in the Coordinator node running the job to restart.

I'm suspecting the document might be invalid given the size issues. Is there a simple way via _search to find the largest document?