1

I am trying to implement integration with elastic search on aws with RestHighLevelClient. the only supported authentication method I found is UsernamePasswordCredentials:

        credentialsProvider.setCredentials(AuthScope.ANY,
                new BasicSessionCredentials("test", "test"));
        RestClientBuilder builder = RestClient.builder(
                new HttpHost("localhost"))
                .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
                    @Override
                    public HttpAsyncClientBuilder customizeHttpClient(
                            HttpAsyncClientBuilder httpClientBuilder) {
                        return httpClientBuilder
                                .setDefaultCredentialsProvider(credentialsProvider);
                    }
                });
       RestHighLevelClient restHighLevelClient = new RestHighLevelClient(builder)

I don't find a way to use RestHighLevelClient with BasicSessionCredentials which I plan to initialize this with assume role credentials

  • Hi, If you are referring to AWSCredentials, then it might be having 3 paramaters from latest documentation. BasicSessionCredentials(String awsAccessKey, String awsSecretKey, String sessionToken) https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/BasicSessionCredentials.html – Anupam Haldkar Jul 03 '23 at 06:03

0 Answers0