这是我们过去用来 ping Elastic Search 节点的代码片段,只是为了检查它是否存在:
Nest.ElasticClient client; // has been initialized
ConnectionStatus connStatus;
client.TryConnect(out connStatus);
var isHealthy = connStatus.Success;
看起来在NEST 0.11.5ElasticClient.TryConnect
中已被删除。它是完全消失了还是只是像 MapRaw/CreateIndexRaw 一样被移到了其他地方?
如果它被删除,这就是我打算做的事情:
Nest.ElasticClient client; // has been initialized
var connectionStatus = client.Connection.GetSync("/");
var isHealthy = connectionStatus.Success;
看起来这行得通 - 还是有更好的替代方法TryConnect
?