RestHighLevelClient request time out not worked

I am using RestHighLevelClient 7.4.2 . I set time outs like below to test:

    public RestHighLevelClient restHighLevelClient() {
        HttpHost[] hosts = elasticsearchEnvironmentConfig.getNodes().stream().map(HttpHost::create).toArray(HttpHost[]::new);
        final RestClientBuilder builder = RestClient.builder(hosts)
                .setRequestConfigCallback(requestConfigBuilder ->

        return new RestHighLevelClient(builder);

Although process took over 200 ms, client doesn't throw a timeoutexception and it returns response.

I researched this issue and i see that peoples suggest to use setMaxRetryTimeoutMillis method. Unfortunately, this method is not supported on 7.4.2 version. When I changed the version to a old version (6.0.1) that supports setMaxRetryTimeoutMillis, time out works.

What do you recommend to get time out exception when request has actually timed out for 7.4.2 version that not support setMaxRetryTimeoutMillis method ?

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