<h1 dir="auto">Bug Description</h1>
<p dir="auto">Usually, the _id field is known as global unique in a index, right?<br>
But I found it become non-unique when a doc's routing field is modified to another value and reindex to ES. Then, there will be two doc alive in diffrent shard but the same index.</p>
<p dir="auto">It seems the delete operation is broadcasted to all shards, but the index operation not.</p>
<p dir="auto">Since it's hard to monitor if the routing filed is modified, the only thing I can do is do an delete operation before each index operation, I really don't like it &gt;_&lt;</p>
<h1 dir="auto">how to reproduce the bug</h1>
<p dir="auto"><code class="notranslate">Tested under both v0.90.0</code></p>
<h2 dir="auto">[1] Create A Index</h2>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl -XPUT 'http://localhost:9200/user' -d '
{
    &quot;mappings&quot;: {
        &quot;User&quot;: {
            &quot;store&quot;: &quot;no&quot;,
            &quot;_id&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;index&quot;: &quot;not_analyzed&quot;,
                    &quot;store&quot;: &quot;yes&quot;
            },
            &quot;_type&quot;: {
                &quot;enabled&quot;: true
            },
            &quot;_routing&quot;: {
                &quot;path&quot;: &quot;tag&quot;,
                &quot;required&quot;: true
            },
            &quot;properties&quot;: {
                &quot;tag&quot;: {
                    &quot;type&quot;: &quot;string&quot;,
                    &quot;index&quot;: &quot;not_analyzed&quot;
                }
            }
        }
    }
}
'"><pre class="notranslate">curl -XPUT <span class="pl-s"><span class="pl-pds">'</span>http://localhost:9200/user<span class="pl-pds">'</span></span> -d <span class="pl-s"><span class="pl-pds">'</span></span>
<span class="pl-s">{</span>
<span class="pl-s">    "mappings": {</span>
<span class="pl-s">        "User": {</span>
<span class="pl-s">            "store": "no",</span>
<span class="pl-s">            "_id": {</span>
<span class="pl-s">                    "type": "string",</span>
<span class="pl-s">                    "index": "not_analyzed",</span>
<span class="pl-s">                    "store": "yes"</span>
<span class="pl-s">            },</span>
<span class="pl-s">            "_type": {</span>
<span class="pl-s">                "enabled": true</span>
<span class="pl-s">            },</span>
<span class="pl-s">            "_routing": {</span>
<span class="pl-s">                "path": "tag",</span>
<span class="pl-s">                "required": true</span>
<span class="pl-s">            },</span>
<span class="pl-s">            "properties": {</span>
<span class="pl-s">                "tag": {</span>
<span class="pl-s">                    "type": "string",</span>
<span class="pl-s">                    "index": "not_analyzed"</span>
<span class="pl-s">                }</span>
<span class="pl-s">            }</span>
<span class="pl-s">        }</span>
<span class="pl-s">    }</span>
<span class="pl-s">}</span>
<span class="pl-s"><span class="pl-pds">'</span></span></pre></div>
<h2 dir="auto">[2] Input Data</h2>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl -XPOST 'http://localhost:9200/user/User/123' -d '{&quot;tag&quot; : &quot;good&quot;}'"><pre class="notranslate">curl -XPOST <span class="pl-s"><span class="pl-pds">'</span>http://localhost:9200/user/User/123<span class="pl-pds">'</span></span> -d <span class="pl-s"><span class="pl-pds">'</span>{"tag" : "good"}<span class="pl-pds">'</span></span></pre></div>
<p dir="auto">{"ok":true,"_index":"user","_type":"User","_id":"123","_version":1}</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl -XPOST 'http://localhost:9200/user/User/123' -d '{&quot;tag&quot; : &quot;bad&quot;}'"><pre class="notranslate">curl -XPOST <span class="pl-s"><span class="pl-pds">'</span>http://localhost:9200/user/User/123<span class="pl-pds">'</span></span> -d <span class="pl-s"><span class="pl-pds">'</span>{"tag" : "bad"}<span class="pl-pds">'</span></span></pre></div>
<p dir="auto">{"ok":true,"_index":"user","_type":"User","_id":"123","_version":1}</p>
<h2 dir="auto">[3] Search</h2>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="curl -XPOST 'http://localhost:9200/user/User/_search' -d '{
  &quot;query&quot;: {
    &quot;term&quot;: {
      &quot;_id&quot;: &quot;123&quot;
    }
  },
  &quot;facets&quot;: {
    &quot;tag&quot;: {
      &quot;terms&quot;: {
        &quot;field&quot;: &quot;tag&quot;
      }
    }
  }
}'"><pre class="notranslate">curl -XPOST <span class="pl-s"><span class="pl-pds">'</span>http://localhost:9200/user/User/_search<span class="pl-pds">'</span></span> -d <span class="pl-s"><span class="pl-pds">'</span>{</span>
<span class="pl-s">  "query": {</span>
<span class="pl-s">    "term": {</span>
<span class="pl-s">      "_id": "123"</span>
<span class="pl-s">    }</span>
<span class="pl-s">  },</span>
<span class="pl-s">  "facets": {</span>
<span class="pl-s">    "tag": {</span>
<span class="pl-s">      "terms": {</span>
<span class="pl-s">        "field": "tag"</span>
<span class="pl-s">      }</span>
<span class="pl-s">    }</span>
<span class="pl-s">  }</span>
<span class="pl-s">}<span class="pl-pds">'</span></span></pre></div>
<p dir="auto">Result:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
    &quot;took&quot;: 1,
    &quot;timed_out&quot;: false,
    &quot;_shards&quot;: {
        &quot;total&quot;: 10,
        &quot;successful&quot;: 10,
        &quot;failed&quot;: 0
    },
    &quot;hits&quot;: {
        &quot;total&quot;: 2,
        &quot;max_score&quot;: 0.30685282,
        &quot;hits&quot;: [
            {
                &quot;_index&quot;: &quot;user&quot;,
                &quot;_type&quot;: &quot;User&quot;,
                &quot;_id&quot;: &quot;123&quot;,
                &quot;_score&quot;: 0.30685282,
                &quot;_source&quot;: {
                    &quot;tag&quot;: &quot;bad&quot;
                }
            },
            {
                &quot;_index&quot;: &quot;user&quot;,
                &quot;_type&quot;: &quot;User&quot;,
                &quot;_id&quot;: &quot;123&quot;,
                &quot;_score&quot;: 0.30685282,
                &quot;_source&quot;: {
                    &quot;tag&quot;: &quot;good&quot;
                }
            }
        ]
    },
    &quot;facets&quot;: {
        &quot;tag&quot;: {
            &quot;_type&quot;: &quot;terms&quot;,
            &quot;missing&quot;: 0,
            &quot;total&quot;: 2,
            &quot;other&quot;: 0,
            &quot;terms&quot;: [
                {
                    &quot;term&quot;: &quot;good&quot;,
                    &quot;count&quot;: 1
                },
                {
                    &quot;term&quot;: &quot;bad&quot;,
                    &quot;count&quot;: 1
                }
            ]
        }
    }
}"><pre class="notranslate"><code class="notranslate">{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 10,
        "successful": 10,
        "failed": 0
    },
    "hits": {
        "total": 2,
        "max_score": 0.30685282,
        "hits": [
            {
                "_index": "user",
                "_type": "User",
                "_id": "123",
                "_score": 0.30685282,
                "_source": {
                    "tag": "bad"
                }
            },
            {
                "_index": "user",
                "_type": "User",
                "_id": "123",
                "_score": 0.30685282,
                "_source": {
                    "tag": "good"
                }
            }
        ]
    },
    "facets": {
        "tag": {
            "_type": "terms",
            "missing": 0,
            "total": 2,
            "other": 0,
            "terms": [
                {
                    "term": "good",
                    "count": 1
                },
                {
                    "term": "bad",
                    "count": 1
                }
            ]
        }
    }
}
</code></pre></div>
<p dir="auto">It seems, that it's not possible to create node that could elect but not to become master.<br>
This option could be useful in some cases.<br>
For example, we have 2 master nodes with data and we want to avoid split brain and the existence of two masters. We can create another instance without data and <code class="notranslate">node.master = true</code>. But this third node can become master. So this node must be able to handle a lot of request and must have low latency connection with other nodes.<br>
But in fact we want to have node with minimum hardware requirement.<br>
Is it possible to add option like "weigth" or "priority" which will be considered in master election?<br>
Another way is to add flag which will disallow to elect current node as master.<br>
Current option <code class="notranslate">node.master</code> controls both actions: to elect and to be elected.</p>