# How can i change Elastic search 6.x shards to 1?

**URL:** <https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905>\
**Category:** Elasticsearch\
**Created:** [September 24, 2019, 4:49pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905 "2019-09-24T16:49:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pamamolf](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@pamamolf](https://discuss.elastic.co/u/pamamolf)\
**Post date:** [September 24, 2019, 4:49pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905/1 "2019-09-24T16:49:58Z")

</div>

Hello

I would like to change from ssh the shards for latest Elastic search 6.x and my index name is "content".

I was using something like:

curl -XPUT [http://localhost:9200/\_template/content](http://localhost:9200/_template/content) -H 'Content-Type: application/json' -d '  
{  
"template" : "content\*",  
"settings" : {  
"number\_of\_shards": 1  
},  
"mappings" : {  
"content" : {  
}  
}  
}'

But it doesn't work as i see again the same default shards....

How can i adjust that and keep also the change permanent ?

Thank you

---

<div class="post-metadata">

**Author:** ![antonio84](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@antonio84](https://discuss.elastic.co/u/antonio84)\
**Post date:** [September 24, 2019, 5:30pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905/2 "2019-09-24T17:30:13Z")

</div>

Did you get a response like "acknowledged" after you ran it?

If you use filebeat, look for the word shards in filebeat.yml. That is assuming you use filebeat to create your index pattern.

---

<div class="post-metadata">

**Author:** ![pamamolf](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@pamamolf](https://discuss.elastic.co/u/pamamolf)\
**Post date:** [September 24, 2019, 5:56pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905/3 "2019-09-24T17:56:42Z")

</div>

Yes i got the acknowledged response....

But when i check using:

curl 'localhost:9200/\_stats?human&pretty'

I see the same default values.

I don't think so that i have that filebeat....

---

<div class="post-metadata">

**Author:** ![alonchis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alonchis/32/52655_2.png) [@alonchis](https://discuss.elastic.co/u/alonchis)\
**Post date:** [September 24, 2019, 7:05pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905/4 "2019-09-24T19:05:22Z")

</div>

new shards are allocated on the next creation of the index.

Say you have an index filebeat-2019.09.24 and change whatever settings on its template. The next index creation, which would be 2019.09.25 is when the new index would grab the new settings and create it.

you can 1) wait until the next index creation date or, 2) reindex, which is to reindex, say, index A to index B, delete index A.  
If you write to an alias, it should work fine, but if you must write to the original name of index A (for example, filebeat-2019.09.24) do the following:

- reindex filebeat-2019.09.24 to filebeat-temp (will take some time depeding on disk speed, size of index, etc)

```auto
POST /_reindex
{
  "source": {
    "index": ["filebeat-2019.09.24j"]
  },
  "dest": {
    "index": "filebeat-temp"
  }
}

```

- once the job completes, delete index filebeat-2019.09.24.  
`GET _tasks?detailed=true&actions=*reindex`  
(once no tasks show up)  
DELETE filebeat-2019.09.24
- reindex a second time filebeat-temp into filebeat-2019.09.24, wait until completion

```auto
POST /_reindex
{
  "source": {
    "index": ["filebeat-temp"]
  },
  "dest": {
    "index": "ffilebeat-2019.09.24"
  }
}

```

- delete filebeat-temp

---

<div class="post-metadata">

**Author:** ![pamamolf](https://avatars.discourse-cdn.com/v4/letter/p/9de0a6/32.png) [@pamamolf](https://discuss.elastic.co/u/pamamolf)\
**Post date:** [September 24, 2019, 7:23pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905/5 "2019-09-24T19:23:26Z")

</div>

Do i have to restart Elastic search ?

As i run again the above command and i got:

{"acknowledged":true}

Then i rebuild the index and all was ok but it reports again:

{  
"\_shards" : {  
"total" : 13,  
"successful" : 7,  
"failed" : 0  
},

☹

---

<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:** [October 22, 2019, 7:23pm UTC](https://discuss.elastic.co/t/how-can-i-change-elastic-search-6-x-shards-to-1/200905/6 "2019-10-22T19:23:30Z")

</div>

Closed on October 22, 2019, 7:23pm UTC

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