Which nodes should participate in election?

I am not clear about, which type of nodes should participate in election.

As I understand from documentation by default, master eligible and data nodes take part in election, when client node don't.

But I can configure this by params:
discovery.zen.master_election.filter_client
discovery.zen.master_election.filter_data

So the question, is when I need to configure this, and what does it influence on?

Why do you want to change this, just let ES handle it!

I'm not going to change it, but I'd like to understand how and why it works?

If you have node/transport clients, for example in your code, you probably don't want them to take part in elections.

So really, you don't want to set that.

I do not understand how can I have nodes in code. As I understand node is an instance of elastic, am I right?

I can't find docs about election process, I understand minimum_master_nodes and split brain, but I can't understand by which principal nodes elect each other.
May be you know, where I can find this information?

Try reading the zen discovery code:
https://github.com/elastic/elasticsearch/tree/master/core/src/main/java/org/elasticsearch/discovery/zen

You raise a good point, I've asked that we document this - https://github.com/elastic/elasticsearch/issues/16463

Guys, thanks for your help.
Source code is exactly what I need.