Logstash conf with stdin input not pushing data into elasticsearch

I ran it with --verbose and found the below error

[2018-03-12T11:41:35,163][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://x.x.x.x:9200/", :error_type=>LogStash::Outputs::Elasticsearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting Elasticsearch at URL 'http://172.x.x.x:9200/'"}