grafana elasticsearch datasource configuration

Viewed 980

I'm trying to configure ElasticSearch data source for Grafana. I have them both running in Docker locally, both have versions 7.2.0. For Grafana I provide ES URL as http://localhost:9200, index name, time field, and ES version. All other parameters stay with the default value. By saving my config I can see in Grafana logs next:

t=2021-02-14T14:55:58+0000 lvl=eror msg="Data proxy error" logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources/proxy/1/<index>/_mapping remote_addr=172.17.0.1 referer="http://localhost:3000/datasources/edit/1/?utm_source=grafana_gettingstarted" error="http: proxy error: dial tcp 127.0.0.1:9200: connect: connection refused"

t=2021-02-14T14:55:58+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/datasources/proxy/1/<index>/_mapping status=502 remote_addr=172.17.0.1 time_ms=1 size=0 referer="http://localhost:3000/datasources/edit/1/?utm_source=grafana_gettingstarted"

I can't get why Grafana tries to get the mapping from some unknown IP. And how to configure it. By the way, request to http://localhost:9200/<index>/_mapping returns me the correct mapping.

1 Answers

According to Grafana Documentation about configuration:

"URL needs to be accessible from the Grafana backend/server", so, try replacing "http://localhost:9200" to "http://elasticsearch:9200" instead. I had the same issue before, and it worked to me replacing this way :)

Plus: "elasticsearch" is the default name of Elasticsearch container (in case you are running with Docker), so that is the reason of the name.

Related