Class OpenSearchClients

java.lang.Object
org.opensearch.data.client.osc.OpenSearchClients

public final class OpenSearchClients extends Object
Utility class to create the different OpenSearch clients
Since:
4.4
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    ClientConfiguration.ClientConfigurationCallback to configure the OpenSearch RestClient's Http client with a HttpAsyncClientBuilder
    static interface 
    ClientConfiguration.ClientConfigurationCallback to configure the RestClient client with a RestClientBuilder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.opensearch.client.opensearch.OpenSearchClient
    createImperative(org.opensearch.client.RestClient restClient)
    Creates a new imperative OpenSearchClient
    static org.opensearch.client.opensearch.OpenSearchClient
    createImperative(org.opensearch.client.RestClient restClient, org.opensearch.client.transport.TransportOptions transportOptions)
    Creates a new imperative OpenSearchClient
    static org.opensearch.client.opensearch.OpenSearchClient
    createImperative(org.opensearch.client.RestClient restClient, org.opensearch.client.transport.TransportOptions transportOptions, org.opensearch.client.json.JsonpMapper jsonpMapper)
    Creates a new imperative OpenSearchClient
    createImperative(org.opensearch.client.transport.OpenSearchTransport transport)
    Creates a new OpenSearchClient that uses the given OpenSearchTransport.
    static org.opensearch.client.opensearch.OpenSearchClient
    createImperative(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration)
    Creates a new imperative OpenSearchClient
    static org.opensearch.client.opensearch.OpenSearchClient
    createImperative(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration, org.opensearch.client.transport.TransportOptions transportOptions)
    Creates a new imperative OpenSearchClient
    static org.opensearch.client.transport.OpenSearchTransport
    getOpenSearchTransport(org.opensearch.client.RestClient restClient, String clientType, org.opensearch.client.transport.TransportOptions transportOptions, org.opensearch.client.json.JsonpMapper jsonpMapper)
    Creates an OpenSearchTransport that will use the given client that additionally is customized with a header to contain the clientType
    static org.opensearch.client.RestClient
    getRestClient(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration)
    Creates a low level RestClient for the given configuration.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • OpenSearchClients

      public OpenSearchClients()
  • Method Details

    • createImperative

      public static org.opensearch.client.opensearch.OpenSearchClient createImperative(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration)
      Creates a new imperative OpenSearchClient
      Parameters:
      clientConfiguration - configuration options, must not be null.
      Returns:
      the OpenSearchClient
    • createImperative

      public static org.opensearch.client.opensearch.OpenSearchClient createImperative(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration, org.opensearch.client.transport.TransportOptions transportOptions)
      Creates a new imperative OpenSearchClient
      Parameters:
      clientConfiguration - configuration options, must not be null.
      transportOptions - options to be added to each request.
      Returns:
      the OpenSearchClient
    • createImperative

      public static org.opensearch.client.opensearch.OpenSearchClient createImperative(org.opensearch.client.RestClient restClient)
      Creates a new imperative OpenSearchClient
      Parameters:
      restClient - the RestClient to use
      Returns:
      the OpenSearchClient
    • createImperative

      public static org.opensearch.client.opensearch.OpenSearchClient createImperative(org.opensearch.client.RestClient restClient, @Nullable org.opensearch.client.transport.TransportOptions transportOptions)
      Creates a new imperative OpenSearchClient
      Parameters:
      restClient - the RestClient to use
      transportOptions - options to be added to each request.
      Returns:
      the OpenSearchClient
    • createImperative

      public static org.opensearch.client.opensearch.OpenSearchClient createImperative(org.opensearch.client.RestClient restClient, @Nullable org.opensearch.client.transport.TransportOptions transportOptions, org.opensearch.client.json.JsonpMapper jsonpMapper)
      Creates a new imperative OpenSearchClient
      Parameters:
      restClient - the RestClient to use
      transportOptions - options to be added to each request.
      jsonpMapper - the mapper for the transport to use
      Returns:
      the OpenSearchClient
    • createImperative

      public static AutoCloseableOpenSearchClient createImperative(org.opensearch.client.transport.OpenSearchTransport transport)
      Creates a new OpenSearchClient that uses the given OpenSearchTransport.
      Parameters:
      transport - the transport to use
      Returns:
      the OpenSearchClient
    • getRestClient

      public static org.opensearch.client.RestClient getRestClient(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration)
      Creates a low level RestClient for the given configuration.
      Parameters:
      clientConfiguration - must not be null
      Returns:
      the RestClient
    • getOpenSearchTransport

      public static org.opensearch.client.transport.OpenSearchTransport getOpenSearchTransport(org.opensearch.client.RestClient restClient, String clientType, @Nullable org.opensearch.client.transport.TransportOptions transportOptions, org.opensearch.client.json.JsonpMapper jsonpMapper)
      Creates an OpenSearchTransport that will use the given client that additionally is customized with a header to contain the clientType
      Parameters:
      restClient - the client to use
      clientType - the client type to pass in each request as header
      transportOptions - options for the transport
      jsonpMapper - mapper for the transport
      Returns:
      OpenSearchTransport