Elasticsearch Java REST high level client and Timeout values

Hello all.

Version using: Elasticsearch server / Java REST high level client, 7.2.0

I was trying to confirm a timeout behavior, so made a RestHighLevelClient like below -

	RestClientBuilder.RequestConfigCallback requestConfigCallback = new RestClientBuilder.RequestConfigCallback() {
		@Override
		public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {
			return requestConfigBuilder
				.setConnectionRequestTimeout(1)
				.setConnectTimeout(1)
				.setSocketTimeout(1);
		}
	};

	RestClientBuilder restClientBuilder = RestClient
		.builder(host)
		.setRequestConfigCallback(requestConfigCallback);

	RestHighLevelClient client = new RestHighLevelClient(restClientBuilder);

You can see just one millisecond timeout values set for client, and these are intended. But still all requests via this client have been taking their time and returned as "success."
And "timeout" fields in Request objects didn't have any effect - In my research they were time allocated for the server, not for the waiting client.

In comparison, requests using plain Spring RestTemplate configured with 1 millisecond timeout values, were almost always guarateed "timed out" as intended.

So is this intended behavior of Java REST high level client? Or am I missing some more timeout setters?

Thank you in advance.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.