How to set heap size via environment variable ES_JAVA_OPTS?

I tried it again. Just added "ES_JAVA_OPTS=-Xms1g -Xmx1g" in .bash_profile, it works. The issue was the property of .bash_file, it only works for the current console/terminal, but not for other consoles/terminals unless you restart Linux.