Trying to send logs

i have installed ELK stack using docker where it has ip-172.x.x.x. which is running on ubuntu machine (with ip 10.2.0.47). now i am trying to send logs of my 2nd ubuntu machine(10.2.0.37) to ELK (10.2.0.47).

so, i have configured filebeat in my 2nd ubuntu machine(10.2.0.37) and configured the output to send elasticsearch (10.2.0.47:9200).
but when i see filebeat logs it says 10.2.0.47:9200 refused connection. so , couldn’t send logs.

also when i tried curl http://10.2.0.47:9200 in elk machine " connection is refused"
but when i try with chrl http://172.x.x.x:9200 in elk machine it works and gives output

-can any one help me. how should i make it accept the logs.