2012-05-15 39 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版本匹配,你会得到“真正的”异常:)