Hello,
I've just updated to elasticsearch version 6.3.0 and seems that rest high level client doesn't work there as has to.
Right now I am using the next code to refresh indexes:
Settings settings = Settings.builder()
.put("client.transport.sniff", true)
.put("cluster.name", "test-signle-cluster")
.build();
System.setProperty("es.set.netty.runtime.available.processors", "false");
TransportClient client = new PreBuiltTransportClient(settings);
client.addTransportAddress(new TransportAddress(InetAddress.getByName("192.168.56.50"), 9300));
And then use the next method to refresh indices:
transportClient.admin().indices().prepareRefresh().get()
Now, I would like to update my client to use REST High Level Client. I've changed my code to:
System.setProperty("es.set.netty.runtime.available.processors", "false");
RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost("192.168.56.50", 9200, "http"));
restClientBuilder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
@Override
public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {
return requestConfigBuilder.setConnectTimeout(60000).setSocketTimeout(60000)
.setConnectionRequestTimeout(0);
}
});
restClientBuilder.setMaxRetryTimeoutMillis(60000);
RestHighLevelClient client = new RestHighLevelClient(restClientBuilder);
And now I try to refresh indices with the next code:
client.indices().refresh(new RefreshRequest());
Unfortunately I am getting an error when I am trying to refresh indices:
java.io.IOException: listener timeout after waiting for [60000] ms
at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:684)
...
Here is the full log: http://paste.openstack.org/show/723460/
Here is my gradle dependencies:
compile "org.elasticsearch:elasticsearch:6.3.0"
compile "org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.0"
compile "org.elasticsearch.client:elasticsearch-rest-client:6.3.0"
compile "org.elasticsearch.client:transport:6.3.0"
Does anyone know why is it happening? My elasticsearch 6.3.0 is running under virtual machine. All ports are open. I can perform requests by using curl
to port 9200 but REST High Level Client doesn't work.
Best regards