# Reindex change shard number

**URL:** <https://discuss.elastic.co/t/reindex-change-shard-number/299337>\
**Category:** Elasticsearch\
**Tags:** curator, reindex\
**Created:** [March 10, 2022, 1:04pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337 "2022-03-10T13:04:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabbar](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gabbar](https://discuss.elastic.co/u/gabbar)\
**Post date:** [March 10, 2022, 1:04pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337/1 "2022-03-10T13:04:03Z")

</div>

Hello community!  
I'm running Elasticsearch 6.8 to store logs collected using graylog and I would like to reduce the amount of shards of the older indices.  
Using curator I've been able to shrink the shards from 6 to 1, when I reindex them in order to rename them to the original one, the amount of shards goes up again to 4.

Here's the action file

```auto
actions:
  1:
    action: reindex
    description: >-
      reindex graylog_100-shrink to graylog_100
    options:
      wait_interval: 30
      max_wait: -1
      request_body:
        source:
          index: graylog_100-shrink
        dest:
          index: graylog_100
    filters:
    - filtertype: none

```

Even the API doesn't seem offer a lot of options about.  
Do you have any recommendation?

Kind regards

---

<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:** [March 10, 2022, 1:04pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337/2 "2022-03-10T13:04:03Z")

</div>

Elasticsearch 6.8 is [EOL](https://www.elastic.co/support/eol) and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

---

<div class="post-metadata">

**Author:** ![gabbar](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gabbar](https://discuss.elastic.co/u/gabbar)\
**Post date:** [March 13, 2022, 5:15pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337/3 "2022-03-13T17:15:10Z")

</div>

Dear system: I'll be glad to upgrade Elasticsearch as soon as Graylog will support a newer version without removing essential features

Kind regards,  
Gabbar

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 13, 2022, 6:21pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337/4 "2022-03-13T18:21:39Z")

</div>

Do you have any template for the `graylog_100` indices?

The number of shards is probably defined in an template, you will need to edit the template to change the number of shards from 4 to any number you want.

Use the `_cat/templates` and `_cat/templates/template-name` APIs to check the templates.

Also, Graylog dropped support for Elasticsearch, the last version they support is the 7.10 which is also approaching EOL.

---

<div class="post-metadata">

**Author:** ![gabbar](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gabbar](https://discuss.elastic.co/u/gabbar)\
**Post date:** [March 14, 2022, 12:02pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337/5 "2022-03-14T12:02:39Z")

</div>

Hello Leandro,  
thank you for the hint. I've been able to override the setting from the template (which is needed for the creation of the newest indices) creating an empty index named "graylog\_100" with the desired amount of shards before the reindexing

```auto
  1:
    action: create_index
    description: "Create index as graylog-100"
    options:
      name: graylog-100
      extra_settings:
        settings:
          number_of_shards: 1
          number_of_replicas: 1
  2:
    action: reindex
    description: >-
      reindex graylog_100-shrink to graylog_100
    options:
      wait_interval: 30
      max_wait: -1
      request_body:
        source:
          index: graylog_100-shrink
        dest:
          index: graylog_100
    filters:
    - filtertype: none

```

curl -X GET '[http://myhost:9200/graylog\_100?pretty'|tail](http://myhost:9200/graylog_100?pretty'%7Ctail) -n 30

```auto
       }
      }
    },
    "settings" : {
      "index" : {
        "refresh_interval" : "30s",
        "number_of_shards" : "1",
        "provided_name" : "graylog_100",
        "creation_date" : "1647258037695",
        "analysis" : {
          "analyzer" : {
            "analyzer_keyword" : {
              "filter" : "lowercase",
              "tokenizer" : "keyword"
            }
          }
        },
        "number_of_replicas" : "1",
        "uuid" : "NDKVA-pHRIygM4TOW-0Lsg",
        "version" : {
          "created" : "6082099"
        }
      }
    }
  }

```

---

<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:** [April 11, 2022, 12:03pm UTC](https://discuss.elastic.co/t/reindex-change-shard-number/299337/6 "2022-04-11T12:03:35Z")

</div>

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