Not exposed ports in docker swarm mode

I’m trying to set up very simple service using docker swarm and I have a problem with exposing ports.

I have two machines, lets name them xxx and yyy. When I do simple

docker run -d -p 9200:9200 -p 9300:9300 elasticsearch:7.4.0

both of them works correctly, I can go to xxx:9200 to have instance of Elasticsearch

I tried to do the same with swarm mode so, on the xxx machine I did:

docker swarm init --advertise-addr [external IP of xxx machine]

I got correct token and I successfully joined yyy machine to the swarm.
Then I created new overlay network using

docker network create -d overlay dockerdemo

and created service in this swarm using

docker service create --name swarmelasticsearch --network dockerdemo --replicas 2 -p 9200:9200 -p 9300:9300 elasticsearch:7.4.0

Service is being created successfully, both of machines have running containers with Elasticsearch, but I cannot go to them from outside. When I go to the xxx:9200 or yyy:9200 or port-of-xxx:9200 nothing happens. I cannot reach my site. Why? Do I need to do anything more? Both of my machines are on Azure VM with Ubuntu + latest docker.

Source: StackOverflow