Elasticsearch OutOfMemoryError Java heap space
I think I have discovered the error. I was using 'service' to run elasticsearch and therefore my environment variables got stripped. I had to update the /etc/default/elasticsearch
file with the correcct env variables (specifically the ES_HEAP_SIZE=16g
).
So far it's running well and app is not erroring.
The correct way to update Java heap size for Elasticsearch 5 is not EXPORT _JAVA_OPTIONS
or EXPORT ES_HEAP_SIZE
or using command line parameters. As far as I can tell, all of these are overridden by a configuration file in your Elasticsearch install directory, config/jvm.options
. To change these settings you need to edit these lines in that file:
# Xms represents the initial size of total heap space# Xmx represents the maximum size of total heap space-Xms2g-Xmx2g