Class AwsRestHighLevelClientFactory


  • public class AwsRestHighLevelClientFactory
    extends Object
    This class creates a REST client injected with an endpoint and credentials.
    • Constructor Detail

      • AwsRestHighLevelClientFactory

        public AwsRestHighLevelClientFactory​(boolean useAwsCredentials)
        Constructs a new client factory (using a builder) that will create clients injected with credentials.
        Parameters:
        useAwsCredentials - if true the factory create clients injected with AWC credentials. If false, it will create clients injected with username/password credentials.
    • Method Detail

      • getOrCreateClient

        public AwsRestHighLevelClient getOrCreateClient​(String endpoint)
        Attempts to get a REST client from the client cache synchronously using the endpoint as a key. If the client does not exist in the cache, createClient() is called to create a new client. The newly created client is then inserted into the cache and stored for later use.
        Parameters:
        endpoint - is the Elasticsearch instance endpoint.
        Returns:
        an Elasticsearch REST client.