简体   繁体   English

使用prepareGet时出现ElasticSearch IndexMissingException

[英]ElasticSearch IndexMissingException while using prepareGet

I am trying to get data from elasticsearch using Java's GET API. 我正在尝试使用Java的GET API从elasticsearch获取数据。 but I keep on getting the IndexMisingException. 但是我继续得到IndexMisingException。

 Exception in thread "main" org.elasticsearch.indices.IndexMissingException: [logstash-*] missing at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:768) at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:691) at org.elasticsearch.cluster.metadata.MetaData.concreteSingleIndex(MetaData.java:748) at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:139) at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:116) at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:89) at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:55) at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:75) at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:98) at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:193) at org.elasticsearch.action.get.GetRequestBuilder.doExecute(GetRequestBuilder.java:201) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65) at elasticConnection.ClientElastic.main(ClientElastic.java:18) 

I have the Index in elasticsearch. 我在Elasticsearch中拥有索引。

 health status **index** pri rep docs.count docs.deleted store.size pri.store.size yellow open **events** 5 1 39 0 48.7kb 48.7kb yellow open **logstash-2016.03.30** 5 1 152 0 137.8kb 137.8kb 

please help. 请帮忙。

Your indexes are still waiting for replica, which generally we avoid when working on a single node. 您的索引仍在等待副本,通常在单个节点上工作时我们避免这样做。

Run this command on your local host : 在本地主机上运行以下命令:

curl -XPUT 'localhost:9200/_settings' -d '{ "index" : { "number_of_replicas" : 0 } }'

This should change the index status to green and your program should be good to go. 这应该将索引状态更改为绿色,并且您的程序应该可以运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM