How to setup shards and number_of_replicas in logstash index

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'
data_type => 'list'
key => 'logstash'
number_of_replicas => 0
number_of_shards => 3

}

}

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

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

and refer to it using

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

1 Like

Awesome Badger,

Thanks so much you help me a lot.

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