2012-05-15 178 views
1

我正在嘗試使用Elastic Search Java API創建索引。創建索引 - 彈性搜索 - Java API

我的代碼是與此類似:

String indexName = "clients"; 
Node node = new NodeBuilder().clusterName(this.clusterName).client(true).node(); 
Client client = node.client(); 

client.admin().indices().prepareCreate(indexName).execute().actionGet(); // It fails here 

if (client != null) client.close(); 
if (node != null) node.close(); 

但每一次,我執行我得到這個錯誤:http://screencast.com/t/MfnTccwho

我在做什麼錯?

+1

請張貼錯誤到正確的問題,而不是一個一個的圖片鏈接。 – skaffman

回答

2

它看起來像elasticsearch客戶端版本和elasticsearch服務器版本之間的不匹配。

0

你還應該檢查elasticsearch集羣的jvm版本和你的客戶端匹配,它發生在我身上,我的客戶端是1.7,並且elasticsearch在openjdk 1.6下運行,拋出異常。

一旦兩個elasticsearch &的Java版本匹配,你會得到「真正的」異常:)