No of buckets creation for composite aggregation

lets say, I have 40000 unique buckets, can i use composite aggregation to fetch 1000 buckets at once, repeat the call until i fetch all the buckets