Issue 1:
Elasticsearch version: 2.4.0

Plugins installed: [kopf, head]

JVM version: OpenJDK 64-Bit Server VM (build 25.92-b14, mixed mode)

Docker version: 1.10.3, build 1f8f545

OS version: 4.7.0-coreos

Description of the problem including expected versus actual behavior:

Deploying elasticsearch cluster with 1 master node + 3 data nodes + 2 clients nodes within Kubernetes Petsets as mentioned here:

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

When i'm trying to create a new index i have this error in master node's logs:

[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)

The bug is mentioned that it was fixed here #20527 .

Docker image used :

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 /

Explanation of the problem here #19554

Kuberenetes elasticsearch integration :

https://github.com/pires/kubernetes-elasticsearch-cluster

Issue 2:
You can manage to slip unexpected characters into field names, like \n, \0 (\u0000), \t, \', \", etc. I think that we should prevent this, but the change would create a backwards incompatible restriction.

Big caveat/counter argument: as long as they're escaped, these unexpected characters are valid JSON.