Lucene max documents limit

I am getting, java.lang.IllegalArgumentException: number of documents in the index cannot exceed 2147483519,

which is due to the sheer number nested documents in elastic search. Looks like lucene treats each nested document as an individual doc so comes the issue.

Yep, there is a 2^31 limit per shard in Lucene.