# Best practice about reindex

**URL:** <https://discuss.elastic.co/t/best-practice-about-reindex/360113>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [May 24, 2024, 3:21am UTC](https://discuss.elastic.co/t/best-practice-about-reindex/360113 "2024-05-24T03:21:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frances\_Chu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frances_chu/32/127298_2.png) [@Frances\_Chu](https://discuss.elastic.co/u/Frances_Chu)\
**Post date:** [May 24, 2024, 3:21am UTC](https://discuss.elastic.co/t/best-practice-about-reindex/360113/1 "2024-05-24T03:21:50Z")

</div>

I got  
index\_A --\> hold the data 2022

index\_B\_Jan --\> hold the data of jan 2023  
index\_B\_Feb --\> hold the data of Feb 2023  
index\_B\_Mar --\> hold the data of Mar 2023  
.....  
index\_B\_Dec --\> hold the data of Dec 2023

now I would like to combine all index of 2022 and 2023

**Method 1**

```auto
POST _reindex
{
  "source": {
    "index": ["index_B_*"]
  },
  "dest": {
    "index": "index_A "
  }
}

```

then remove index\_B\_\*

**Method 2**

```auto
POST _reindex
{
  "source": {
    "index": ["index_B_*"]
  },
  "dest": {
    "index": "index_C "
  }
}

```

```auto
POST _reindex
{
  "source": {
    "index": ["index_A", "index_C"]
  },
  "dest": {
    "index": "index_D "
  }
}

```

Then remove index\_A, index\_B\*, index\_C

I would like to know that is the best practice. Which method perferred. Or there is any other better method.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 24, 2024, 8:19am UTC](https://discuss.elastic.co/t/best-practice-about-reindex/360113/2 "2024-05-24T08:19:47Z")

</div>

Depending on your use case, you could also think of just using an alias which points to all your indices...

I'll probably do method1 as it avoids reindexing one of the indices.

---

<div class="post-metadata">

**Author:** ![Frances\_Chu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frances_chu/32/127298_2.png) [@Frances\_Chu](https://discuss.elastic.co/u/Frances_Chu)\
**Post date:** [May 24, 2024, 9:13am UTC](https://discuss.elastic.co/t/best-practice-about-reindex/360113/3 "2024-05-24T09:13:24Z")

</div>

Big thx.

I am actually attempting to minimize the number of shards as well. 😉

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 24, 2024, 1:39pm UTC](https://discuss.elastic.co/t/best-practice-about-reindex/360113/4 "2024-05-24T13:39:35Z")

</div>

How many shards do you have per index? If more than one, you can also use [Shrink index API | Elasticsearch Guide [8.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shrink-index.html)
