what is the command that is used to retrieve ES_HEAP_SIZE ?
echo $ES_HEAP_SIZE
it is working on some of the nodes but for some other nodes the output is empty, what could be the reason?
Unless you add it to .bashrc (if you use bash) it's only set to current user session.
Best way is to incorporate it into command launching ES instance.
I.e. ES_HEAP_SIZE=8g /usr/share/elasticsearch/bin/elasticsearch
ES_HEAP_SIZE can be set/found in /etc/init.d/elasticsearch or /etc/sysconfig/elasticsearch by default
So if it's set, you may find it using the "echo" command above. If it's not set, you won't be able to find it using the echo command, this means ES will do its best to assign one for you.
If you run "ps -ef | grep elastic" in the machine where you have ES running, in the output of this command, you'll see something like -Xms2g -Xmx2g or something similar, that is the ES_HEAP_SIZE value you are looking for. If you set it to 4g in one of the files above, you'll see -Xms4g -Xmx4g.
If you don't know what -Xms<value> -Xmx<value> is, search for Java -X on the internet.