# What is segments.terms\_memory\_in\_bytes?

**URL:** <https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621>\
**Category:** Elasticsearch\
**Created:** [December 10, 2016, 12:46pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621 "2016-12-10T12:46:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [December 10, 2016, 12:46pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/1 "2016-12-10T12:46:12Z")

</div>

I use plugin head to monitor elasticsearch cluster, and I found that the segments.terms\_memory\_in\_bytes occupy most of the memory:

"segments": {  
"count": 6813,  
"memory\_in\_bytes": 39858854460,  
"terms\_memory\_in\_bytes": 37379779192,  
"stored\_fields\_memory\_in\_bytes": 2461982384,  
"term\_vectors\_memory\_in\_bytes": 0,  
"norms\_memory\_in\_bytes": 6998592,  
"doc\_values\_memory\_in\_bytes": 10094292,  
"index\_writer\_memory\_in\_bytes": 16501940,  
"index\_writer\_max\_memory\_in\_bytes": 7467965004,  
"version\_map\_memory\_in\_bytes": 137381,  
"fixed\_bit\_set\_memory\_in\_bytes": 0  
}

what is it ? and how to reduce it?

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [December 10, 2016, 1:13pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/2 "2016-12-10T13:13:15Z")

</div>

That's the heap memory Lucene uses to load the index into the terms dictionary and postings for indexed fields. It's a compact structure (a finite state transducer) so it's suprising yours are taking so much heap.

Do you have many indexed fields? High cardinality indexed fields?

Mike McCandless

---

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [December 10, 2016, 3:35pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/3 "2016-12-10T15:35:08Z")

</div>

yeah， At the first I use the default mapping, and every field will be indexed. can move some of them from heap by myself?

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [December 10, 2016, 9:56pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/4 "2016-12-10T21:56:55Z")

</div>

The only way to do that is to stop indexing them.

Mike McCandless

---

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [December 12, 2016, 3:15am UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/5 "2016-12-12T03:15:04Z")

</div>

new data will not insert into this index, and this index will be seldom searched. I delete some old data of this index, but the terms\_memory\_in\_bytes is not changed. Why

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [December 12, 2016, 1:03pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/6 "2016-12-12T13:03:57Z")

</div>

To see a reduction in the terms heap usage, the segments containing the documents you deleted need to be merged away.

If the indices really will no longer change, you could `forceMerge` them but this is a costly operation.

Mike McCandless

---

<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:** [January 9, 2017, 1:04pm UTC](https://discuss.elastic.co/t/what-is-segments-terms-memory-in-bytes/68621/7 "2017-01-09T13:04:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
