我想知道这里是否有人使用过RestHighLevelClient连接到亚马逊网络服务ElasticSearch。不确定这是否是亚马逊网络服务ElasticSearch支持的东西。我现在每次尝试连接时都会收到一个ConnectionClosedException。
这就是我所拥有的:
public SearchResponse getQuery(){
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(new HttpHost("localhost", 4430, "http")));
SearchRequest searchRequest = new SearchRequest("msglog-dev-2018.05.21");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchAllQuery());
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = null;
try{
searchResponse =client.search(searchRequest);
}catch(IOException e){
e.printStackTrace();
}
return searchResponse;
}我得到的错误是
org.apache.http.ConnectionClosedException: Connection closed
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:347)
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:261)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
...........https://stackoverflow.com/questions/51329657
复制相似问题