How to settings a elasticsearch cluster correctly

Hello!
According to the terms of reference, I have to set up a cluster of five nodes.

I have a number of questions.

  1. Can I specify one of the nodes simultaneously as a master node and as a data node?

  2. If I specified one master node (coordinator), what happens if it fails? Will other nodes choose a new coordinator? How to properly configure the nodes so that when the coordinator fails, they choose a new one from the remaining four nodes?

You can have 3 nodes as master & data

Okay, I'm just worried that if one of the three masters fails, then a situation might occur: Split brain. Am I correct in understanding that when two masters work, this can happen? If so, how can this situation be avoided?

Three master eligible nodes protect you from split brain scenarios.

I understand, but if one of the three fails, what then?

Then the remaining two can still form a majority until the failed node returns.

Well thank you!
I found the information I needed:
In Elasticsearch, setting node.master: true does not mean that this node is a master, it just says that it can be selected as a master node.

Is it really so?

Yes. Each cluster only has one master node at any time but this need to be able to change if you want HA which is why you need 3 or more master eligible nodes.

Thank!