Class OpenSearchConfiguration

java.lang.Object
org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport
org.opensearch.data.client.osc.OpenSearchConfiguration

public abstract class OpenSearchConfiguration extends org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport
Base class for a @Configuration class to set up the OpenSearch connection using the OpenSearch Client. This class exposes different parts of the setup as Spring beans. Deriving classes must provide the ClientConfiguration to use.
Since:
4.4
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.springframework.data.elasticsearch.client.ClientConfiguration
    Must be implemented by deriving classes to provide the ClientConfiguration.
    org.opensearch.client.json.JsonpMapper
    Provides the JsonpMapper bean that is used in the opensearchTransport(RestClient, JsonpMapper) method.
    org.opensearch.client.opensearch.OpenSearchClient
    opensearchClient(org.opensearch.client.transport.OpenSearchTransport transport)
    Provides the OpenSearchClient to be used.
    org.springframework.data.elasticsearch.core.ElasticsearchOperations
    opensearchOperations(org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter elasticsearchConverter, org.opensearch.client.opensearch.OpenSearchClient elasticsearchClient)
    Creates a ElasticsearchOperations implementation using an OpenSearchClient.
    org.opensearch.client.RestClient
    opensearchRestClient(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration)
    Provides the underlying low level OpenSearch RestClient.
    org.opensearch.client.transport.OpenSearchTransport
    opensearchTransport(org.opensearch.client.RestClient restClient, org.opensearch.client.json.JsonpMapper jsonpMapper)
    Provides the OpenSearch transport to be used.
    org.opensearch.client.transport.TransportOptions
     

    Methods inherited from class org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport

    elasticsearchCustomConversions, elasticsearchEntityMapper, elasticsearchMappingContext, fieldNamingStrategy, getInitialEntitySet, getMappingBasePackages, refreshPolicy, scanForEntities, writeTypeHints

    Methods inherited from class java.lang.Object

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

    • OpenSearchConfiguration

      public OpenSearchConfiguration()
  • Method Details

    • clientConfiguration

      @Bean(name="elasticsearchClientConfiguration") public abstract org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration()
      Must be implemented by deriving classes to provide the ClientConfiguration.
      Returns:
      configuration, must not be null
    • opensearchRestClient

      @Bean public org.opensearch.client.RestClient opensearchRestClient(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration)
      Provides the underlying low level OpenSearch RestClient.
      Parameters:
      clientConfiguration - configuration for the client, must not be null
      Returns:
      RestClient
    • opensearchTransport

      @Bean public org.opensearch.client.transport.OpenSearchTransport opensearchTransport(org.opensearch.client.RestClient restClient, org.opensearch.client.json.JsonpMapper jsonpMapper)
      Provides the OpenSearch transport to be used. The default implementation uses the RestClient bean and the JsonpMapper bean provided in this class.
      Returns:
      the OpenSearchTransport
      Since:
      5.2
    • opensearchClient

      @Bean public org.opensearch.client.opensearch.OpenSearchClient opensearchClient(org.opensearch.client.transport.OpenSearchTransport transport)
      Provides the OpenSearchClient to be used.
      Parameters:
      transport - the OpenSearchTransport to use
      Returns:
      OpenSearchClient instance
    • opensearchOperations

      @Bean(name={"elasticsearchOperations","elasticsearchTemplate","opensearchOperations","opensearchTemplate"}) public org.springframework.data.elasticsearch.core.ElasticsearchOperations opensearchOperations(org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter elasticsearchConverter, org.opensearch.client.opensearch.OpenSearchClient elasticsearchClient)
      Creates a ElasticsearchOperations implementation using an OpenSearchClient.
      Returns:
      never null.
    • jsonpMapper

      @Bean public org.opensearch.client.json.JsonpMapper jsonpMapper()
      Provides the JsonpMapper bean that is used in the opensearchTransport(RestClient, JsonpMapper) method.
      Returns:
      the JsonpMapper to use
      Since:
      5.2
    • transportOptions

      public org.opensearch.client.transport.TransportOptions transportOptions()
      Returns:
      the options that should be added to every request. Must not be null