Cannot connect to Elasticsearch as a datasource Bad Gateway error

Cannot connect to Elasticsearch as a datasource. I am having an issue using elasticsearch as a datasource. When I configure the datasource and hit the save & test button I get a “Bad Gateway” error. I am also unable to connect to elastic search on http://localhost:9200.

I have installed Elesticsearch as a plugin in Grafana. I am using Grafana v9.2.2.

I am new to Grafana. I need your help to solve this puzzle.

This is your main issue. Its not a grafana issue. What version of es and what does the error log from elastic search say.