ERROR: Elasticsearch exited unexpectedly, with exit code 137

I have managed to solved it on my own.

So exit code 137 means that Elasticsearch is taking up too much memory in my server.

My solution was to locate jvm.options in /etc/elasticsearch.

I have copied a jvm.options into jvm.options.d and uncommented a line to set this inside.

-Xms1g
-Xmx1g

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
-Xms1g
-Xmx1g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.14/heap-size.html
## for more information
##

Hope it helps!

1 Like