# How to re configure a data stream for lowering the usage of shards

**URL:** https://discuss.elastic.co/t/how-to-re-configure-a-data-stream-for-lowering-the-usage-of-shards/289530
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management, datastreams
**Created:** [November 18, 2021, 5:41am UTC](https://discuss.elastic.co/t/how-to-re-configure-a-data-stream-for-lowering-the-usage-of-shards/289530 "2021-11-18T05:41:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vijayebpzr](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@vijayebpzr](https://discuss.elastic.co/u/vijayebpzr)
#### Post date: [November 18, 2021, 5:41am UTC](https://discuss.elastic.co/t/how-to-re-configure-a-data-stream-for-lowering-the-usage-of-shards/289530/1 "2021-11-18T05:41:02Z")

</div>

I have a data stream which is associated with an index template which create 3 shards per index daily. This is a time based indices which creates new index daily. We are approaching the maximum number of allowed shards in our cluster and hence we need to re index these existing data stream indices so that we can lower the number of shards . We are not afforded to spin up new nodes. The indicies in this data stream is very low in size and most of them in KBs.Could you please help with some options.

We have 3 master nodes and 3 data nodes in our cluster.

---

<div class="post-metadata">

### Author: ![matschaffer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matschaffer/32/95396_2.png) [@matschaffer](https://discuss.elastic.co/u/matschaffer)
#### Post date: [November 18, 2021, 7:13am UTC](https://discuss.elastic.co/t/how-to-re-configure-a-data-stream-for-lowering-the-usage-of-shards/289530/2 "2021-11-18T07:13:36Z")

</div>

Hi vijaybpzr!

You can use the [shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html) to reduce the number of shards for a given index. Note that the index must be readonly and all primary shards must reside on the same node.

If your indices use an ILM policy you can also have ILM handle this process as part of your phase actions. See [Shrink | Elasticsearch Guide [7.15] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-shrink.html) for more information.

---

<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: [December 16, 2021, 7:14am UTC](https://discuss.elastic.co/t/how-to-re-configure-a-data-stream-for-lowering-the-usage-of-shards/289530/3 "2021-12-16T07:14:01Z")

</div>

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