Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch 2.11.0
opensearch-java:2.14.0
spring-data-opensearch:1.5.3
Describe the issue:
My team is planning to migrate the ORHLC client to the OpenSearch Java client (opensearch-java). We are also considering a gradual migration, as we anticipate that the process will take some time. We’re not opting for an immediate switch due to the complexity involved.
I define both configurations, and the application fails to start.
How can I resolve this issue?
Is it able to define both?
Configuration:
I defined both of configuration.
import org.opensearch.client.RestHighLevelClient
import org.opensearch.data.client.orhlc.AbstractOpenSearchConfiguration
import org.opensearch.data.client.orhlc.ClientConfiguration
import org.opensearch.data.client.orhlc.RestClients
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class RestClientConfig : AbstractOpenSearchConfiguration() {
@Bean
override fun opensearchClient(): RestHighLevelClient {
val clientConfiguration =
ClientConfiguration
.builder()
.connectedTo("localhost:9200")
.build()
return RestClients.create(clientConfiguration).rest()
}
}
import org.opensearch.data.client.osc.OpenSearchConfiguration
import org.springframework.context.annotation.Configuration
@Configuration
class RestClientConfiguration : OpenSearchConfiguration() {
override fun clientConfiguration(): org.springframework.data.elasticsearch.client.ClientConfiguration =
org.springframework.data.elasticsearch.client.ClientConfiguration
.builder()
.connectedTo("localhost:9200")
.build()
}
Relevant Logs or Screenshots: