# How to re-index if I have changed the shard numbers?

**URL:** <https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966>\
**Category:** Elasticsearch\
**Created:** [January 24, 2016, 7:15am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966 "2016-01-24T07:15:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thyfere](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@thyfere](https://discuss.elastic.co/u/thyfere)\
**Post date:** [January 24, 2016, 7:15am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/1 "2016-01-24T07:15:25Z")

</div>

Hi,

I am newbie to ELK. I have set up the ELK stack on two Windows boxes; one is for ES and Kibana and other Logstash. I have configured the ES with default config therefore, 5 shards were created though I am using only one node. Now if I change the shard number to 1, I may need to re-index the data, right? If yes, how can I do that?

---

<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:** [January 24, 2016, 7:17am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/2 "2016-01-24T07:17:17Z")

</div>

If you want the change to apply to existing indices, yes.

Check out [https://gist.github.com/markwalkom/8a7201e3f6ea4354ae06](https://gist.github.com/markwalkom/8a7201e3f6ea4354ae06)

---

<div class="post-metadata">

**Author:** ![thyfere](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@thyfere](https://discuss.elastic.co/u/thyfere)\
**Post date:** [January 24, 2016, 10:54am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/3 "2016-01-24T10:54:02Z")

</div>

The following is our logstash-indexer.cfg. How can I edit it for re-indexing. As I have mentioned that I know very little about ELK, please excuse my stupid questions.

input {

tcp {  
codec =\> "json"  
port =\> 5544  
tags =\> ["windows","nxlog"]  
type =\> "nxlog-json"  
}  
}  
input {  
#udp Exchange syslogs stream via 5544

udp {  
type =\> "Exchange"  
port =\> 5544  
}  
} # end input

# I have filters for nxlog-json and Microsoft Exchange... I am not mentioning here the whole but references only.

filter {

if [type] == "nxlog-json" {  
date {  
match =\> ["[EventTime]", "YYYY-MM-dd HH:mm:ss"]  
# timezone =\> "Europe/London"  
}

if [type] == "Exchange" {  
csv {  
add\_tag =\> ['exh\_msg\_trk']  
columns =\> ['logdate', 'client\_ip', 'client\_hostname', 'server\_ip', 'server\_hostname', 'source\_context', 'connector\_id', 'source', 'event\_id', 'internal\_message\_id', 'message\_id', 'network\_message\_id', 'recipient\_address', 'recipient\_status', 'total\_bytes', 'recipient\_count', 'related\_recipient\_address', 'reference', 'message\_subject', 'sender\_address', 'return\_path', 'message\_info', 'directionality', 'tenant\_id', 'original\_client\_ip', 'original\_server\_ip', 'custom\_data']  
remove\_field =\> ["logdate"]  
}  
grok {  
match =\> ["message", "%{TIMESTAMP\_ISO8601:timestamp}"]  
}  
output {  
elasticsearch {  
host =\> "192.195.88.229"  
protocol =\> "http"  
# stdout { codec =\> rubydebug}  
}  
} # end output

---

<div class="post-metadata">

**Author:** ![thyfere](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@thyfere](https://discuss.elastic.co/u/thyfere)\
**Post date:** [January 24, 2016, 11:14am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/4 "2016-01-24T11:14:37Z")

</div>

As soon as I changed the shards, now Kibana is asking a new pattern.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Colton](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jeremy\_Colton](https://discuss.elastic.co/u/Jeremy_Colton)\
**Post date:** [July 26, 2016, 10:29am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/5 "2016-07-26T10:29:04Z")

</div>

Hi @warkolm, I edited the elasticsearch-template.json to have 'number\_of\_shards: 1'. I re-started ES. I assume that only a new daily index will be created with 1 shard? How can I now use your logstash script to re-index into the existing daily indices? Or is this not possible since the existing indices are already configured to have the default 5 shards each?

Many thanks.

---

<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:** [July 26, 2016, 10:33am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/6 "2016-07-26T10:33:21Z")

</div>

Please start a new thread for your question 🙂

---

<div class="post-metadata">

**Author:** ![Jeremy\_Colton](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@Jeremy\_Colton](https://discuss.elastic.co/u/Jeremy_Colton)\
**Post date:** [July 26, 2016, 10:46am UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/7 "2016-07-26T10:46:00Z")

</div>

@warkolm [Changing shard number per index due to EsRejectedExecutionException](https://discuss.elastic.co/t/changing-shard-number-per-index-due-to-esrejectedexecutionexception/56383) 🙂

---

<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:** [July 5, 2017, 10:32pm UTC](https://discuss.elastic.co/t/how-to-re-index-if-i-have-changed-the-shard-numbers/39966/8 "2017-07-05T22:32:55Z")

</div>


