private RestClient getAnonymousClient(ElasticsearchContainer container) {
        if (anonymousClient == null) {
            anonymousClient = RestClient.builder(HttpHost.create(container.getHttpHostAddress())).build();
        }

        return anonymousClient;
    }
From 6.8, we can optionally activate security with a default password.
modules/elasticsearch/src/test/java/org/testcontainers/elasticsearch/ElasticsearchContainerTest.java