Stop all nodes while stopping master node

Hi,
I have configured my elasticsearch cluster configuration like below
Node 1 : Master Node only
Node 2: Master/data
Node 3: data node only

I have configured master eligible node Node1 and node2

When i stopped node1 then all node are stopping i am not able to connect through head plugin .
if node 1 stopped then node2 should be taken as master right ??

Then i should be connected through headplugin but it is not happening .

Could you please help me why it is happening so.

What version are you on?
What do your logs show?

I am using version 7.4.2
I can see the status from terminal it is running but when i was trying to connect from elasticsearch head plugin on that time i am not able to connect if i stopped master node

You should always look to have at least 3 master-eligible nodes. Having 2 is bad and does not provide high availability.

yes i got your point .
Master eligible nodes if i selected three that means all three are master only or master/data both.

I would change the data only node to be master/data.

ok ... last thing i need to clear suppose i have configured like below
Node1 : master
Node2: master/data
Node3: master/data
master eligible node : Node1, Node2, Node3

Now if i stop Node1 then Node2 and Node3 will work right

Your cluster will be operational with one node down but not more than that.