What is the recommended Java heap size for Elasticsearch?

It depends on what you will be doing. If you use faceting, aggregations, or parent/child queries you will need more heap space. It might make sense to run some performance tests and monitor the heap to figure out what a good heap size would be.

Regardless, we do not recommend setting heap larger than 31GB and not more than half available memory, whichever is lower. (e.g. 128GB of available memory = max 30GB heap, 64GB of available memory = max 31GB heap, 32GB of available memory = max 16GB heap). This upper limit is required to ensure the underlying Lucene software can make use of compressed pointers, which offer a major performance gain.