【发布时间】:2011-08-04 19:16:30
【问题描述】:
我最近发现了 Elasticsearch,我决定试一试。不幸的是,我无法添加索引。
用于添加索引的代码如下,每次尝试添加新索引时都会运行:
public void index ( String index, String type, String id, String json ){
Node node = null;
try{
node = nodeBuilder().node();
Client client = node.client();
IndexResponse response = client.prepareIndex( index, type, id )
.setSource( json )
.execute()
.actionGet();
}
catch ( Exception e ){
Logger.error( e, " Error indexing JSON file: " + json );
}
finally {
if( node != null)
node.close();
}
}
似乎没有添加任何索引,并且我的 Cluster helath 目前是红色的(因为其中一个分片是红色的),但我不知道如何解决这个问题。我收到确认每次都在添加我的索引,但在搜索或在 es-admin 中时它们没有显示。
非常感谢所有帮助或想法。
【问题讨论】:
标签: java elasticsearch sharding