# Term aggregation on frozen index cause field data cache increase continuously

**URL:** <https://discuss.elastic.co/t/term-aggregation-on-frozen-index-cause-field-data-cache-increase-continuously/225770>\
**Category:** Elasticsearch\
**Created:** [March 31, 2020, 2:09am UTC](https://discuss.elastic.co/t/term-aggregation-on-frozen-index-cause-field-data-cache-increase-continuously/225770 "2020-03-31T02:09:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stone\_xy](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@stone\_xy](https://discuss.elastic.co/u/stone_xy)\
**Post date:** [March 31, 2020, 2:09am UTC](https://discuss.elastic.co/t/term-aggregation-on-frozen-index-cause-field-data-cache-increase-continuously/225770/1 "2020-03-31T02:09:13Z")

</div>

ES Version: 7.1.1  
JVM Heap: 4GB

Repro steps:  
Create an index with keyword field type and insert serveral docs, freeze that index, than run term query agaist the frozen index, we will see field data cache increase and seems never cleared.

```auto
	PUT foo1
	{
	  "settings": {
		"number_of_shards": 1,
		"number_of_replicas": 0
	  },
	  "mappings": {
		"properties": {
		  "education": {
			"type": "keyword"
		  }
		}
	  }
	}

	POST foo1/_doc
	{
	  "education": "master"
	}

	POST foo1/_doc
	{
	  "education": "bachelor"
	}

	POST foo1/_doc
	{
	  "education": "PhD"
	}

	POST foo1/_freeze

```

run term query repeatly:

```auto
	GET foo1/_search?ignore_throttled=false
	{
	  "size": 0,
	  "aggs": {
		"max_ed": {
		  "terms": {
			"field": "education"
		  }
		}
	  }
	}

```

check the field data:

```auto
    GET _cat/fielddata?v

```

after several hours run the same term query, es process start to full gc:

```auto
	[2020-03-30T06:13:43,433][WARN][o.e.m.j.JvmGcMonitorService] [node-1] [gc][24765] overhead, spent [3.4s] collecting in the last [4s]
	[2020-03-30T06:14:00,960][INFO][o.e.m.j.JvmGcMonitorService] [node-1] [gc][24782] overhead, spent [301ms] collecting in the last [1s]
	[2020-03-30T06:14:09,183][INFO][o.e.m.j.JvmGcMonitorService] [node-1] [gc][24790] overhead, spent [335ms] collecting in the last [1s]
	[2020-03-30T06:14:19,479][WARN][o.e.m.j.JvmGcMonitorService] [node-1] [gc][24798] overhead, spent [3s] collecting in the last [3.2s]

```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 31, 2020, 3:57am UTC](https://discuss.elastic.co/t/term-aggregation-on-frozen-index-cause-field-data-cache-increase-continuously/225770/2 "2020-03-31T03:57:39Z")

</div>

I would recommend always forcemerging indices you are going to freeze down to a single segment first. Have you done this? If not, can you try this and see if it makes a difference?

---

<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:** [April 28, 2020, 3:59am UTC](https://discuss.elastic.co/t/term-aggregation-on-frozen-index-cause-field-data-cache-increase-continuously/225770/3 "2020-04-28T03:59:26Z")

</div>

Closed on April 28, 2020, 3:59am UTC

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