I am getting an error when running my Rust app on k8s pod that try to connect to elasticsearch DB pod inside the same cluster. I am not sure why this is not work bz when I try portforward the elastic and replace the es_url with the localhost my Api work like charm.
pub fn get_es_client() -> Arc {
ES_CLIENT.get_or_init(|| {
let es_url = "http://test-dev-db-es-http.default.svc.cluster.local:9200";
let transport = Transport::single_node(&es_url)
.expect("Can't create transport");
Arc::new(Elasticsearch::new(transport))
}).clone()
}