in case if u are using a ssl certificate in logstash and elastic you have to mention in the ssl certificate path in the config file at output... and if u are using authentication mechanism in elastic(ur elastic server is enabled with username and password) then those details also has to be in config file.
https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-up-authentication.html
This is applicable only if certificate and authentication is enabled else in output ur elastichosts and index name is enough