I’ve installed Elasticsearch with homebrew on my OSX Macbook (source)

brew tap elastic/tap
brew install elastic/tap/elasticsearch-full

note you also need to install Java JDK source

Now if I start elasticsearch it consumes 4GB - 8GB of Ram == not good

In order to change this I need to change value of JVM HEAP size for ELasticsearch in jvm.options file

Now because homebrew installed Elasticsearch 7.16 the path where my ES conf files are located is:


(your path to this file may be different)

Now I need to add following lines to the jvm.options file:

# ...
# ...

This will use 1 GB of Ram

if I want even less memory consumption I can do

# ...
# ...

to use 300 MB of memory

Remember to stop/start your ES service in order for this to take any effect

brew services stop  elasticsearch-full
brew services start elasticsearch-full

If you googled this note and you are using Ubuntu check my older note: change Ubuntu elasticsearch memory consumption