9
我最近发现了Elasticsearch,我决定玩一玩。不幸的是,我在添加索引时遇到了麻烦。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();
}
}
没有指标出现,我的集群helath目前红(作为一个的碎片是红色的),但我不知道如何解决这个问题。我收到确认,我的索引每次都被添加,但在搜索或es-admin时不显示。
非常感谢您的帮助和建议。