Can you curl the Elasticsearch endpoint from inside the logstash container? or from your host?
From inside container try this (using what you are using will probably fail)
curl -v http://<elasticsearch>:9200
Or try this... (probably will work)
curl -v http://host.docker.internal:9200
From outside container
curl -v http://localhost:9200
Do you know how docker networks ... how to get one container to connect to another