diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java b/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java index 81c5e1310ac..5888596052c 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/http/netty/NettyHttpServerTransport.java @@ -257,7 +257,8 @@ public class NettyHttpServerTransport extends AbstractLifecycleComponent implem } @Override public TransportStats stats() { - return new TransportStats(serverOpenChannels.numberOfOpenChannels()); + OpenChannelsHandler channels = serverOpenChannels; + return new TransportStats(channels == null ? 0 : channels.numberOfOpenChannels()); } @Override public void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, TransportRequestOptions options) throws IOException, TransportException {