# Create an index that includes aggs

**URL:** <https://discuss.elastic.co/t/create-an-index-that-includes-aggs/296813>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 10, 2022, 8:16am UTC](https://discuss.elastic.co/t/create-an-index-that-includes-aggs/296813 "2022-02-10T08:16:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![b.kaliuzhnyi](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@b.kaliuzhnyi](https://discuss.elastic.co/u/b.kaliuzhnyi)\
**Post date:** [February 10, 2022, 8:16am UTC](https://discuss.elastic.co/t/create-an-index-that-includes-aggs/296813/1 "2022-02-10T08:16:48Z")

</div>

Can I create an index with data obtained with bucket aggregation from another index?

For example:

> old\_index: fox; dog; dog; fox; fox;  
> new\_index: fox, 3; dog, 2;

Is it possible to do this for some indexes within ILM?  
And can I delete `old_index` immediately when creating `new_index`?

---

<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:** [February 10, 2022, 8:23am UTC](https://discuss.elastic.co/t/create-an-index-that-includes-aggs/296813/2 "2022-02-10T08:23:11Z")

</div>

Take a look at [Rolling up historical data | Elasticsearch Guide [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/xpack-rollup.html)

---

<div class="post-metadata">

**Author:** ![b.kaliuzhnyi](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@b.kaliuzhnyi](https://discuss.elastic.co/u/b.kaliuzhnyi)\
**Post date:** [February 10, 2022, 8:39am UTC](https://discuss.elastic.co/t/create-an-index-that-includes-aggs/296813/3 "2022-02-10T08:39:00Z")

</div>

Thanks! This is what I need.

---

<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:** [March 10, 2022, 8:39am UTC](https://discuss.elastic.co/t/create-an-index-that-includes-aggs/296813/4 "2022-03-10T08:39:01Z")

</div>

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