CentOS 7を入れた開発用の貧弱鯖(メモリなんと2GB)で公式yumリポジトリからElasticsearchの最新版を入れて起動したところメモリを食いつぶしてちょっとしたクエリを投げるたびにプロセスが落ちるという困ったことになりました
起動時のプロセス見たら-XmsオプションでJVMが2GBも確保してくださりやがってたので嫌な予感はしてたのですが・・・
で、ぐぐってみたのですが、起動スクリプトにES_HEAP_SIZEを云々という記述はよくあるものの、どうもこれには当てはまらず
最初から読んどけという公式ドキュメントにズバリなところがありました
Set JVM heap size via jvm.options
つまり、/etc/elasticsearch/jvm.optionsファイルに全部書いてあったっていう
/etc/elaasticsearch/jvm.options
## JVM configuration
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms2g # ここと
-Xmx2g # ここ
ここをメモリに応じて1g/1mみたいな記法で書けばいい感じ