2011-11-14 25 views

回答

-1

謝伊先前確認這種方法是一個好方法。該方法由the documentation as well備份。

至於優雅的處理。您應該錯誤地嘗試執行搜索的請求或進程。有可能TransportClient成爲連接並且未來的請求可能成功。

爲了完整起見,在這裏複製你的函數。

private void verifyConnection(TransportClient client) { 
    ImmutableList<DiscoveryNode> nodes = client.connectedNodes(); 
    if (nodes.isEmpty()) { 
     throw new ElasticSearchUnavailableException("No nodes available. Verify ES is running!"); 
    } else { 
     log.info("connected to nodes: " + nodes.toString()); 
    } 
} 

https://gist.github.com/1364734

+1

downvoting的答案沒有任何細節只是一個鏈接,該鏈接是死 –

+0

鏈接是死 – Mehran

+1

@ PaulD'Ambra你應該修復鏈接或優惠將來進行編輯。對一個6歲的問題跳投不是很有建設性。 – Andy

相關問題