# How to get the ES\_HEAP\_SIZE?

**URL:** <https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210>\
**Category:** Elasticsearch\
**Created:** [May 17, 2016, 10:31am UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210 "2016-05-17T10:31:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sravani\_amarachinta](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@sravani\_amarachinta](https://discuss.elastic.co/u/sravani_amarachinta)\
**Post date:** [May 17, 2016, 10:31am UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210/1 "2016-05-17T10:31:18Z")

</div>

what is the command that is used to retrieve ES\_HEAP\_SIZE ?

---

<div class="post-metadata">

**Author:** ![yezooz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yezooz/32/9779_2.png) [@yezooz](https://discuss.elastic.co/u/yezooz)\
**Post date:** [May 17, 2016, 1:36pm UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210/2 "2016-05-17T13:36:02Z")

</div>

`echo $ES_HEAP_SIZE`

---

<div class="post-metadata">

**Author:** ![sravani\_amarachinta](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@sravani\_amarachinta](https://discuss.elastic.co/u/sravani_amarachinta)\
**Post date:** [May 18, 2016, 10:42am UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210/3 "2016-05-18T10:42:50Z")

</div>

it is working on some of the nodes but for some other nodes the output is empty, what could be the reason?

---

<div class="post-metadata">

**Author:** ![yezooz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yezooz/32/9779_2.png) [@yezooz](https://discuss.elastic.co/u/yezooz)\
**Post date:** [May 18, 2016, 10:58am UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210/4 "2016-05-18T10:58:55Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![thn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thn/32/8061_2.png) [@thn](https://discuss.elastic.co/u/thn)\
**Post date:** [May 18, 2016, 11:04am UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210/5 "2016-05-18T11:04:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:50pm UTC](https://discuss.elastic.co/t/how-to-get-the-es-heap-size/50210/6 "2017-07-05T22:50:44Z")

</div>


