# Save a field into another index

**URL:** <https://discuss.elastic.co/t/save-a-field-into-another-index/292455>\
**Category:** Elasticsearch\
**Created:** [December 20, 2021, 11:38am UTC](https://discuss.elastic.co/t/save-a-field-into-another-index/292455 "2021-12-20T11:38:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kosodrom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kosodrom/32/99278_2.png) [@Kosodrom](https://discuss.elastic.co/u/Kosodrom)\
**Post date:** [December 20, 2021, 11:38am UTC](https://discuss.elastic.co/t/save-a-field-into-another-index/292455/1 "2021-12-20T11:38:19Z")

</div>

Hi folks,

I am using the [mapper size plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-size.html) to save the size of the document to be able to create dashboards, so a developer can see how much log data he produces within his containers in kubernetes/openshift. I am using Filebeat -\> Logstash -\> Elastic for this setup.

The problem is now that when the retention time for the index is over and the index is deleted, the `_size` information is also gone. My goal is to keep it for statistics and analytics for longer period of time and the question is:

How can get the `_size` field along with some other information (like namespace, container name) and save it to another index (lets say `sizes_index`) with its own ILM policy? I was thinking just to add another output to my logstash pipeline but the `_size` field is created during the index time in Elasticsearch and is not present for logstash pipelines

Thanks for any hint.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 21, 2021, 5:18am UTC](https://discuss.elastic.co/t/save-a-field-into-another-index/292455/2 "2021-12-21T05:18:48Z")

</div>

[Analyze index disk usage API | Elasticsearch Guide [7.16] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-disk-usage.html) might be an alternative you can use here, as long as you are on a newer version.

However you can probably do this with a rollup - [Rolling up historical data | Elasticsearch Guide [7.16] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-rollup.html)

---

<div class="post-metadata">

**Author:** ![Kosodrom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kosodrom/32/99278_2.png) [@Kosodrom](https://discuss.elastic.co/u/Kosodrom)\
**Post date:** [December 21, 2021, 10:18am UTC](https://discuss.elastic.co/t/save-a-field-into-another-index/292455/3 "2021-12-21T10:18:55Z")

</div>

Thanks @warkolm for quick response.

> [Analyze index disk usage API | Elasticsearch Guide [7.16] | Elastic ](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-disk-usage.html) might be an alternative you can use here, as long as you are on a newer version.

This is interesting, but unfortunately not fitting my use case. I need to have the information based on the namespaces and container names which are also part of the documents, so I need to know the size of each individual document and aggregate it based on the namespaces.

> However you can probably do this with a rollup - [Rolling up historical data | Elasticsearch Guide [7.16] | Elastic ](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-rollup.html)

This sounds interesting. I will look into this!

---

<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 18, 2022, 10:19am UTC](https://discuss.elastic.co/t/save-a-field-into-another-index/292455/4 "2022-01-18T10:19:18Z")

</div>

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