This is probably because you are trying to index too many elements at once. Make sure you are using ordinary queries . If you are already using mem_limit queries, mem_limit help may help, as it prompts. merge_block_size based on mem_limit and the number of documents.
If you are interested in how it generates this number, check the source. It is freely available.
source share