diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java index 4c9f8b28832..35d627c03c1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java @@ -136,7 +136,7 @@ public abstract class TransportShardSingleOperationAction retryListener = new RetryListener(callback, listener, nodes, index); try { callback.doWithNode(nodes.get((index) % nodes.size()), retryListener); - } catch (ConnectTransportException e) { - retryListener.onFailure(e); + } catch (ElasticSearchException e) { + if (e.unwrapCause() instanceof ConnectTransportException) { + retryListener.onFailure(e); + } else { + throw e; + } } } @@ -197,7 +204,7 @@ public class TransportClientNodesService extends AbstractComponent { } @Override public void onFailure(Throwable e) { - if (e instanceof ConnectTransportException) { + if (ExceptionsHelper.unwrapCause(e) instanceof ConnectTransportException) { int i = ++this.i; if (i == nodes.size()) { listener.onFailure(new NoNodeAvailableException()); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java index e4b77309faf..c2051d00cce 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java @@ -187,9 +187,15 @@ public class DiscoveryNodes implements Iterable { Set resolvedNodesIds = new HashSet(nodesIds.length); for (String nodeId : nodesIds) { if (nodeId.equals("_local")) { - resolvedNodesIds.add(localNodeId()); + String localNodeId = localNodeId(); + if (localNodeId != null) { + resolvedNodesIds.add(localNodeId); + } } else if (nodeId.equals("_master")) { - resolvedNodesIds.add(masterNodeId()); + String masterNodeId = masterNodeId(); + if (masterNodeId != null) { + resolvedNodesIds.add(masterNodeId); + } } else if (nodeExists(nodeId)) { resolvedNodesIds.add(nodeId); } else {