# X GB data in Elasticsearch then X GB memory used?

**URL:** https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687
**Category:** Elasticsearch
**Created:** [December 9, 2015, 2:29am UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687 "2015-12-09T02:29:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Enniu\_51](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enniu_51/32/5310_2.png) [@Enniu\_51](https://discuss.elastic.co/u/Enniu_51)
#### Post date: [December 9, 2015, 2:29am UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687/1 "2015-12-09T02:29:18Z")

</div>

We deployed a 2 node Elasticsearch cluster with 2\*30 GB memory.

I noticed when there is X GB data in cluster, then roughly X GB memory used.

Today es used 35 GB memory already with 55.9 GB data , what will happens if we have 100 GB data? Will Elasticsearch go down with `no java heap space` exception?

What's more, if we only have X GB memory, does it means we could hold (roughly) X GB data at most in Elasticsearch?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 9, 2015, 7:37am UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687/2 "2015-12-09T07:37:21Z")

</div>

> What's more, if we only have X GB memory, does it means we could hold (roughly) X GB data at most in Elasticsearch?

No, it's not that simple. There is no formula that can be used to calculate the heap needed for a given amount of data.

---

<div class="post-metadata">

### Author: ![Enniu\_51](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enniu_51/32/5310_2.png) [@Enniu\_51](https://discuss.elastic.co/u/Enniu_51)
#### Post date: [December 9, 2015, 8:06am UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687/3 "2015-12-09T08:06:56Z")

</div>

Thanks for your reply!

If we don't want to add more nodes, is it the only choice to close old index and maintain the data amount which es holds not exceed a threshold(even though there is no formula for that threshold)?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 9, 2015, 9:02am UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687/4 "2015-12-09T09:02:31Z")

</div>

Closing or deleting indexes isn't the only way of reducing the cluster's memory pressure, but short-term (if the heap utilization is near the ceiling) it's probably the easiest way. Other things to do could include changing the mapping use less memory and, if you have many shards, reduce the number of shards.

---

<div class="post-metadata">

### Author: ![Enniu\_51](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enniu_51/32/5310_2.png) [@Enniu\_51](https://discuss.elastic.co/u/Enniu_51)
#### Post date: [December 9, 2015, 9:23am UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687/5 "2015-12-09T09:23:22Z")

</div>

Thanks for your suggestions!

---

<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, 11:32pm UTC](https://discuss.elastic.co/t/x-gb-data-in-elasticsearch-then-x-gb-memory-used/36687/6 "2017-07-05T23:32:22Z")

</div>


