# Reducing number of shards in 6.5 ES

**URL:** https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709
**Category:** Elasticsearch
**Created:** [August 20, 2020, 6:05am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709 "2020-08-20T06:05:48Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 20, 2020, 6:05am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/1 "2020-08-20T06:05:48Z")

</div>

I tried to reduce number of shards in ES 6.5 version from default(5) to 1 using  
'PUT \_template/temp\_new1  
{  
"index\_patterns" : ["test1-\*"],  
"settings" : {  
"number\_of\_shards" : 1,  
"number\_of\_replicas" : 1  
}  
}'

It worked in single node cluster not in 3-node cluster.  
How can i reduce number of shards in my 3 node cluster

---

<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: [August 20, 2020, 6:06am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/2 "2020-08-20T06:06:56Z")

</div>

Welcome to our community! 😃

What do you mean by didn't work?

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 20, 2020, 6:20am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/3 "2020-08-20T06:20:22Z")

</div>

number of shards did not change for newly created 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: [August 20, 2020, 6:25am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/4 "2020-08-20T06:25:16Z")

</div>

Can you show the output of `_cat/indices/test*?v` for us?

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 20, 2020, 7:39am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/5 "2020-08-20T07:39:00Z")

</div>

> [@warkolm](#):
>
> \_cat/indices/test\*?v

from 3 node cluster  
'test1-02 2 p STARTED 0 261b x.x.x.x node-1  
test1-02 2 r UNASSIGNED  
test1-02 4 p STARTED 0 261b x.x.x.x node-1  
test1-02 4 r UNASSIGNED  
test1-02 3 p STARTED 0 261b x.x.x.x node-1  
test1-02 3 r UNASSIGNED  
test1-02 1 p STARTED 0 261b x.x.x.x node-1  
test1-02 1 r UNASSIGNED  
test1-02 0 p STARTED 0 261b x.x.x.xnode-1  
test1-02 0 r UNASSIGNED '

---

<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: [August 21, 2020, 1:05am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/6 "2020-08-21T01:05:37Z")

</div>

Thanks.  
Were these indices created before or after you added the template?

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 21, 2020, 2:49am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/7 "2020-08-21T02:49:38Z")

</div>

after adding template

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [August 21, 2020, 3:30am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/8 "2020-08-21T03:30:49Z")

</div>

What does your elasticsearch.yml files look like in your 3- node cluster? Have you got [minimum\_master\_nodes set correctly to avoid split brain scenarios](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/modules-node.html#split-brain)?

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 24, 2020, 9:45am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/9 "2020-08-24T09:45:27Z")

</div>

# ======================== Elasticsearch Configuration =========================

# 

# NOTE: Elasticsearch comes with reasonable defaults for most settings.

# Before you set out to tweak and tune the configuration, make sure you

# understand what are you trying to accomplish and the consequences.

# 

# The primary way of configuring a node is via this file. This template lists

# the most important settings you may want to configure for a production cluster.

# 

# Please consult the documentation for further information on configuration options:

# [https://www.elastic.co/guide/en/elasticsearch/reference/index.html](https://www.elastic.co/guide/en/elasticsearch/reference/index.html)

# 

# ---------------------------------- Cluster -----------------------------------

# 

# Use a descriptive name for your cluster:

# 

#cluster.name: my-application

# 

# ------------------------------------ Node ------------------------------------

# 

# Use a descriptive name for the node:

# 

node.name: node-1  
#node.master: true  
#node.data: true  
#node.ingest: true

# 

# Add custom attributes to the node:

# 

#node.attr.rack: r1

# 

# ----------------------------------- Paths ------------------------------------

# 

# Path to directory where to store the data (separate multiple locations by comma):

# 

path.data: /var/lib/elasticsearch

# 

# 

# Path to log files:

# 

path.logs: /var/log/elasticsearch

# 

# ----------------------------------- Memory -----------------------------------

# 

# Lock the memory on startup:

# 

#bootstrap.memory\_lock: true

# 

# Make sure that the heap size is set to about half the memory available

# on the system and that the owner of the process is allowed to use this

# limit.

# 

# Elasticsearch performs poorly when the system is swapping the memory.

# 

# ---------------------------------- Network -----------------------------------

# 

# Set the bind address to a specific IP (IPv4 or IPv6):

# 

network.host: x.x.x.x

# 

# Set a custom port for HTTP:

# 

http.port: 9200

# 

# For more information, consult the network module documentation.

# 

# --------------------------------- Discovery ----------------------------------

# 

# Pass an initial list of hosts to perform discovery when new node is started:

# The default list of hosts is ["127.0.0.1", "[::1]"]

# 

discovery.zen.ping.unicast.hosts: ["x.x.x.x","x.x.x.x","x.x.x.x"]

# 

# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):

# 

#discovery.zen.minimum\_master\_nodes: 2

# 

# For more information, consult the zen discovery module documentation.

# 

# ---------------------------------- Gateway -----------------------------------

# 

# Block initial recovery after a full cluster restart until N nodes are started:

# 

#gateway.recover\_after\_nodes: 3

# 

# For more information, consult the gateway module documentation.

# 

# ---------------------------------- Various -----------------------------------

# 

# Require explicit names when deleting indices:

# 

#action.destructive\_requires\_name: true

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 24, 2020, 9:50am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/10 "2020-08-24T09:50:21Z")

</div>

No minimum zen nodes have not been set

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [August 24, 2020, 10:01am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/11 "2020-08-24T10:01:37Z")

</div>

Then the cluster is not correctly configured which could cause split brain problems. Make sure minimum\_master\_nodes is set to 3 on all nodes and restart.

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 24, 2020, 5:26pm UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/12 "2020-08-24T17:26:07Z")

</div>

Thanks a lot for the solution.Will try it

---

<div class="post-metadata">

### Author: ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)
#### Post date: [August 26, 2020, 5:17am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/13 "2020-08-26T05:17:13Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> cluster is not correctly configured

Thanks a lot!!!! it worked

---

<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: [September 23, 2020, 5:17am UTC](https://discuss.elastic.co/t/reducing-number-of-shards-in-6-5-es/245709/14 "2020-09-23T05:17:16Z")

</div>

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