# How to change default of Elasticsearch

**URL:** https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356
**Category:** Elasticsearch
**Created:** [January 23, 2019, 8:14am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356 "2019-01-23T08:14:33Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 8:14am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/1 "2019-01-23T08:14:33Z")

</div>

HI  
how to change default of Elasticsearch 6.3 from five shards to more than 5 shards to kibana 5.1.1

Best regards

---

<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: [January 23, 2019, 8:18am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/2 "2019-01-23T08:18:13Z")

</div>

You can use an [index template](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/indices-templates.html) to control the number of shards. If you create one with `"*"` index pattern that matches everything, this will become the default. Be aware that Kibana 5.1.1 will not work with Elasticsearch 6.3.

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 8:27am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/3 "2019-01-23T08:27:26Z")

</div>

Dear

where put the file of index template ?

notes the kibana work with elasticsearch 6.3

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/6413bc3c765ee44a7ecd10c5e330771b4e16be97.png)

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 8:33am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/4 "2019-01-23T08:33:29Z")

</div>

I try to put index template under /etc/elasticsearch/

after that restart services of elasticsearch.servic ,logstash.service and kibana

after that the kibana down

these configuration used  
{  
"index\_patterns": ["te\*", "bar\*"],  
"settings": {  
"number\_of\_shards": 10  
},  
"mappings": {  
"\_doc": {  
"\_source": {  
"enabled": false  
},  
"properties": {  
"host\_name": {  
"type": "keyword"  
},  
"created\_at": {  
"type": "date",  
"format": "EEE MMM dd HH:mm:ss Z YYYY"  
}  
}  
}  
}  
}

---

<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: [January 23, 2019, 9:03am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/5 "2019-01-23T09:03:35Z")

</div>

You need to add the template through the Console application (Under Dev Tools) in Kibana. You also need to upgrade Kibana as you are likely to run into issues eventually as the are not compatible.

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 10:00am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/6 "2019-01-23T10:00:32Z")

</div>

Dear I put Under Dev Tools and restart a services but nothing change

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/d/fdbf1cc344e0cbc3330a065d59b1d80d37edb3d0.png)

---

<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: [January 23, 2019, 11:00am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/7 "2019-01-23T11:00:51Z")

</div>

Try putting something like this:

```auto
PUT _template/default_shard_count
{
  "index_patterns": ["*"],
  "order" : 1000,
  "settings": {
    "number_of_shards": 1
  }
}

```

This will set the default primary shard count top 1 for all new indices and will allow you to overrode it as the `order` value is quite high.

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 11:17am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/8 "2019-01-23T11:17:42Z")

</div>

Dear

I put this

PUT \_template/default\_shard\_count  
{  
"index\_patterns": ["\*"],  
"order" : 1000,  
"settings": {  
"number\_of\_shards": 10  
}  
}  
after that restart services of elasticsearch.servic ,logstash.service and kibana but nothing change

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/4/144225dd08f36746a684ba9c0d7338c0e42e4e3c.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/c/dc8c8bc5275bafe13b080deaac48562375ce451d.png)

---

<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: [January 23, 2019, 11:29am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/9 "2019-01-23T11:29:09Z")

</div>

It's only applied to new indices. Not to old ones.

Also, I don't see the relationship between the number of shards and the screen capture you pasted. Could you explain what you are looking for?

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 11:44am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/10 "2019-01-23T11:44:23Z")

</div>

Dear

this old one

GET \_search

{

"query": {

"match\_all": {}

}

}

after that change to  
PUT \_template/default\_shard\_count  
{  
"index\_patterns": ["\*"],  
"order" : 1000,  
"settings": {  
"number\_of\_shards": 10  
}  
}  
but the reason some nothing change . the kibana receives 5 servers

also i try put this code  
PUT \_template/template\_1  
{  
"index\_patterns": ["te\*", "bar\*"],  
"settings": {  
"number\_of\_shards": "\*"  
},  
"mappings": {  
"\_doc": {  
"\_source": {  
"enabled": false  
},  
"properties": {  
"host\_name": {  
"type": "keyword"  
},  
"created\_at": {  
"type": "date",  
"format": "EEE MMM dd HH:mm:ss Z YYYY"  
}  
}  
}  
}  
}

also some nothing change

---

<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: [January 23, 2019, 11:54am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/11 "2019-01-23T11:54:51Z")

</div>

The template will only apply to new indices when they are created, not existing ones. If you want to change the number of primary shards for existing indices you need to use the [shrink index](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/indices-shrink-index.html) or [split index](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/indices-split-index.html) APIs.

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 23, 2019, 12:23pm UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/12 "2019-01-23T12:23:20Z")

</div>

Dear Eng

I check for shrink index the configuration put in Dev tools in the kibana or create file in server

PUT /my\_source\_index/\_settings { "settings": { "index.routing.allocation.require.\_name": "shrink\_node\_name", ![](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/images/icons/callouts/1.png) "index.blocks.write": true ![](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/images/icons/callouts/2.png) } }

---

<div class="post-metadata">

### Author: ![waelco](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@waelco](https://discuss.elastic.co/u/waelco)
#### Post date: [January 24, 2019, 11:58am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/13 "2019-01-24T11:58:19Z")

</div>

Dear Christian\_Dahlqvist & dadoonet

i road about [shrink index]

but I confuse how i can do in server Linux7 ?  
I try to put configuration int file /etc/elasticsearch/elasticsearch.yml  
after that restart services elasticsearch then the kibana not work

kindly i wish know how add shrink to elasticsearch

notes  
this is configuration used in the file /etc/elasticsearch/elasticsearch.yml

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/c/ac44977d65ab78aebd4072652f63a1449df25bf3.png)

BR

---

<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: [February 21, 2019, 11:58am UTC](https://discuss.elastic.co/t/how-to-change-default-of-elasticsearch/165356/14 "2019-02-21T11:58:31Z")

</div>

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