Package org.opensearch.data.client.osc
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract org.springframework.data.elasticsearch.client.ClientConfigurationMust be implemented by deriving classes to provide theClientConfiguration.org.opensearch.client.json.JsonpMapperProvides the JsonpMapper bean that is used in theopensearchTransport(RestClient, JsonpMapper)method.org.opensearch.client.opensearch.OpenSearchClientopensearchClient(org.opensearch.client.transport.OpenSearchTransport transport) Provides theOpenSearchClientto be used.org.springframework.data.elasticsearch.core.ElasticsearchOperationsopensearchOperations(org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter elasticsearchConverter, org.opensearch.client.opensearch.OpenSearchClient elasticsearchClient) Creates aElasticsearchOperationsimplementation using anOpenSearchClient.org.opensearch.client.RestClientopensearchRestClient(org.springframework.data.elasticsearch.client.ClientConfiguration clientConfiguration) Provides the underlying low level OpenSearch RestClient.org.opensearch.client.transport.OpenSearchTransportopensearchTransport(org.opensearch.client.RestClient restClient, org.opensearch.client.json.JsonpMapper jsonpMapper) Provides the OpenSearch transport to be used.org.opensearch.client.transport.TransportOptionsMethods inherited from class org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport
elasticsearchCustomConversions, elasticsearchEntityMapper, elasticsearchMappingContext, fieldNamingStrategy, getInitialEntitySet, getMappingBasePackages, refreshPolicy, scanForEntities, writeTypeHints
-
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 theClientConfiguration.- 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 theRestClientbean and theJsonpMapperbean 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 theOpenSearchClientto be used.- Parameters:
transport- theOpenSearchTransportto 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 aElasticsearchOperationsimplementation using anOpenSearchClient.- Returns:
- never null.
-
jsonpMapper
@Bean public org.opensearch.client.json.JsonpMapper jsonpMapper()Provides the JsonpMapper bean that is used in theopensearchTransport(RestClient, JsonpMapper)method.- Returns:
- the
JsonpMapperto 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
-