How to setup shards and number_of_replicas in logstash index


(William Paixão) #1

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

}

}


#2

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"
    }
}


(William Paixão) #3

Awesome Badger,

Thanks so much you help me a lot.


(system) #4

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