Mtericbeat - error - Failed to connect to elasticsearch

I'm new to ELK. here is my doubt - we had installed ELK lite on a linux server(A) and trying to install metricbeat on a different server(B) but my metricbeat is failed to connect to elasticsearch(A).

  1. metricbeat i installed on the same server(A) and it is connected to elasticsearch(A) as well
  2. metricbeat on server(B) is getting connected to logstash(A) but fail to connect elasticsearch(A).

metricbeat.yml-->

output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["sd-vyrg-uptx:9200"]

  # Optional protocol and basic auth credentials.
   protocol: "https"
   username: "username"
   password: "pwd"

Please suggest.

please share errors and logfile excerpts to help debugging. Thanks!

Issue resolved. thanks for your reply.