Is it possible to add the "number of replicas" in logstash code , rather than in index template?

Hello,

I wanted to know if its possible to mention "number of replicas" in the logstash code , rather than in index template , so when i rollover the index , this is inherited by the newer index.

Mine is a single node instance , so i need to set the replica number to "zero"

I don't think so, replica is a elasticsearch concept, logstash has no knowledge about the number of primary shards or replicas and no setting to change this.

You will need to use an index template for your index.