<p dir="auto"><strong>Elasticsearch version</strong>: 2.4.0</p>
<p dir="auto"><strong>Plugins installed</strong>: [kopf, head]</p>
<p dir="auto"><strong>JVM version</strong>: OpenJDK 64-Bit Server VM (build 25.92-b14, mixed mode)</p>
<p dir="auto"><strong>Docker version</strong>:  1.10.3, build 1f8f545</p>
<p dir="auto"><strong>OS version</strong>:  4.7.0-coreos</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:</p>
<p dir="auto">Deploying elasticsearch cluster with 1 master node + 3 data nodes + 2 clients nodes within Kubernetes Petsets as mentioned here:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" NAME                 READY     STATUS    RESTARTS   AGE
es-client-petset-0   1/1       Running   0          1h
es-client-petset-1   1/1       Running   0          1h
es-data-petset-0     1/1       Running   0          1h
es-data-petset-1     1/1       Running   0          1h
es-data-petset-2     1/1       Running   0          1h
es-master-petset-0   1/1       Running   0          1h"><pre class="notranslate"><code class="notranslate"> NAME                 READY     STATUS    RESTARTS   AGE
es-client-petset-0   1/1       Running   0          1h
es-client-petset-1   1/1       Running   0          1h
es-data-petset-0     1/1       Running   0          1h
es-data-petset-1     1/1       Running   0          1h
es-data-petset-2     1/1       Running   0          1h
es-master-petset-0   1/1       Running   0          1h
</code></pre></div>
<p dir="auto">When i'm trying to create a new index i have this error in master node's logs:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2016-09-21 13:00:34,438][WARN ][cluster.action.shard     ] [Dragoness] [test][0] received shard failed for target shard [[test][0], node[Tzu-jiwLQRCdJVjup2sAJw], [P], v[1], s[INITIALIZING], a[id=0ofHwW7AQzGzB18TfJqY3A], unassigned_info[[reason=INDEX_CREATED], at[2016-09-21T13:00:34.381Z]]], indexUUID [kiW55aX0QvaDnzZIFESt-w], message [failed to create shard], failure [NullPointerException[null]]
java.lang.NullPointerException
        at org.elasticsearch.index.shard.ShardPath.selectNewPathForShard(ShardPath.java:241)
        at org.elasticsearch.index.IndexService.createShard(IndexService.java:336)
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyInitializingShard(IndicesClusterStateService.java:620)
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyNewOrUpdatedShards(IndicesClusterStateService.java:520)
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterStateService.java:177)
        at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:610)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)"><pre class="notranslate"><code class="notranslate">[2016-09-21 13:00:34,438][WARN ][cluster.action.shard     ] [Dragoness] [test][0] received shard failed for target shard [[test][0], node[Tzu-jiwLQRCdJVjup2sAJw], [P], v[1], s[INITIALIZING], a[id=0ofHwW7AQzGzB18TfJqY3A], unassigned_info[[reason=INDEX_CREATED], at[2016-09-21T13:00:34.381Z]]], indexUUID [kiW55aX0QvaDnzZIFESt-w], message [failed to create shard], failure [NullPointerException[null]]
java.lang.NullPointerException
        at org.elasticsearch.index.shard.ShardPath.selectNewPathForShard(ShardPath.java:241)
        at org.elasticsearch.index.IndexService.createShard(IndexService.java:336)
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyInitializingShard(IndicesClusterStateService.java:620)
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyNewOrUpdatedShards(IndicesClusterStateService.java:520)
        at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterStateService.java:177)
        at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:610)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
</code></pre></div>
<p dir="auto">The bug is mentioned that it was fixed here <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="177433899" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/20527" data-hovercard-type="pull_request" data-hovercard-url="/elastic/elasticsearch/pull/20527/hovercard" href="https://github.com/elastic/elasticsearch/pull/20527">#20527</a> .</p>
<p dir="auto">Docker image used :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FROM quay.io/pires/docker-elasticsearch:2.4.1
MAINTAINER *
ADD do_not_use.yml /elasticsearch/config/elasticsearch.yml

# Install Elasticsearch plug-ins
RUN /elasticsearch/bin/plugin install io.fabric8/elasticsearch-cloud-kubernetes/2.4.0_01 --verbose
RUN /elasticsearch/bin/plugin install mobz/elasticsearch-head
RUN /elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf/2.0
# Override elasticsearch.yml config, otherwise plug-in install will fail
ADD elasticsearch.yml /elasticsearch/config/elasticsearch.yml

# Copy run script
COPY run.sh /"><pre class="notranslate"><code class="notranslate">FROM quay.io/pires/docker-elasticsearch:2.4.1
MAINTAINER *
ADD do_not_use.yml /elasticsearch/config/elasticsearch.yml

# Install Elasticsearch plug-ins
RUN /elasticsearch/bin/plugin install io.fabric8/elasticsearch-cloud-kubernetes/2.4.0_01 --verbose
RUN /elasticsearch/bin/plugin install mobz/elasticsearch-head
RUN /elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf/2.0
# Override elasticsearch.yml config, otherwise plug-in install will fail
ADD elasticsearch.yml /elasticsearch/config/elasticsearch.yml

# Copy run script
COPY run.sh /
</code></pre></div>
<p dir="auto">Explanation of the problem here <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="167111508" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/19554" data-hovercard-type="pull_request" data-hovercard-url="/elastic/elasticsearch/pull/19554/hovercard" href="https://github.com/elastic/elasticsearch/pull/19554">#19554</a><br>
Kuberenetes elasticsearch integration :<br>
<a href="https://github.com/pires/kubernetes-elasticsearch-cluster">https://github.com/pires/kubernetes-elasticsearch-cluster</a></p>
<p dir="auto">You can manage to slip unexpected characters into field names, like <code class="notranslate">\n</code>, <code class="notranslate">\0</code> (<code class="notranslate">\u0000</code>), <code class="notranslate">\t</code>, <code class="notranslate">\'</code>, <code class="notranslate">\"</code>, etc. I think that we should prevent this, but the change would create a backwards incompatible restriction.</p>
<p dir="auto">Big caveat/counter argument: as long as they're escaped, these unexpected characters <em>are</em> valid JSON.</p>