How can nested queries return only the first nested document but not all nested documents

What about changing your model? Instead of indexing a big document containing an array of sub-documents, just index individual sub-documents as apparently you want to aggregate on sub-documents, not parent documents themselves.

If you have other question, I'd suggest that you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.