# How to setup shards and number\_of\_replicas in logstash index

**URL:** https://discuss.elastic.co/t/how-to-setup-shards-and-number-of-replicas-in-logstash-index/132864
**Category:** Logstash
**Created:** [May 22, 2018, 5:30pm UTC](https://discuss.elastic.co/t/how-to-setup-shards-and-number-of-replicas-in-logstash-index/132864 "2018-05-22T17:30:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![William\_Paixao](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@William\_Paixao](https://discuss.elastic.co/u/William_Paixao)
#### Post date: [May 22, 2018, 5:30pm UTC](https://discuss.elastic.co/t/how-to-setup-shards-and-number-of-replicas-in-logstash-index/132864/1 "2018-05-22T17:30:10Z")

</div>

Hello guys,

There is a away to setup logstash to send shards and number\_of\_replicas to Elasticsearch in your index ?

i.e.:

input {  
redis {  
host =\> '[redis.sample.com](http://redis.sample.com)'  
data\_type =\> 'list'  
key =\> 'logstash'  
number\_of\_replicas =\> 0  
number\_of\_shards =\> 3

```
}

```

}

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 22, 2018, 5:57pm UTC](https://discuss.elastic.co/t/how-to-setup-shards-and-number-of-replicas-in-logstash-index/132864/2 "2018-05-22T17:57:25Z")

</div>

If you want to control the number of shards and replicas you can do it on the elasticsearch output using a template. You could put this in a file

```auto
{
    "template": "somename-*",
    "settings": {
        "number_of_shards": 2,
        "number_of_replicas" : 0
    }
}

```

and refer to it using

```auto
output {
    elasticsearch {
        hosts => ["localhost"]
        index => "somename-1"
        template => "/some/path/somename.json"
        template_name => "somename"
        template_overwrite => "false"
    }
}

```

---

<div class="post-metadata">

### Author: ![William\_Paixao](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@William\_Paixao](https://discuss.elastic.co/u/William_Paixao)
#### Post date: [May 22, 2018, 6:13pm UTC](https://discuss.elastic.co/t/how-to-setup-shards-and-number-of-replicas-in-logstash-index/132864/3 "2018-05-22T18:13:42Z")

</div>

Awesome Badger,

Thanks so much you help me a lot.

---

<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: [June 19, 2018, 6:13pm UTC](https://discuss.elastic.co/t/how-to-setup-shards-and-number-of-replicas-in-logstash-index/132864/4 "2018-06-19T18:13:44Z")

</div>

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