Skip to content

Commit f346092

Browse files
sobychackomarkpollack
authored andcommitted
HttpHost regression issues in OpenSearchVectorStoreAutoConfiguration
Changes introduced for #2954 introduced a regression in the way OpenSearch works with test containers. Restore the retrieval of HttpHost from OpenSearchConnectionDetails insted of getting them directly from properties. Signed-off-by: Soby Chacko <soby.chacko@broadcom.com>
1 parent 54e5c07 commit f346092

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

auto-configurations/vector-stores/spring-ai-autoconfigure-vector-store-opensearch/src/main/java/org/springframework/ai/vectorstore/opensearch/autoconfigure/OpenSearchVectorStoreAutoConfiguration.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,14 @@ static class OpenSearchConfiguration {
105105

106106
@Bean
107107
@ConditionalOnMissingBean
108-
OpenSearchClient openSearchClient(OpenSearchVectorStoreProperties properties, Optional<SslBundles> sslBundles) {
109-
HttpHost[] httpHosts = properties.getUris().stream().map(this::createHttpHost).toArray(HttpHost[]::new);
108+
OpenSearchClient openSearchClient(OpenSearchVectorStoreProperties properties,
109+
OpenSearchConnectionDetails connectionDetails, Optional<SslBundles> sslBundles) {
110+
111+
HttpHost[] httpHosts = connectionDetails.getUris()
112+
.stream()
113+
.map(s -> createHttpHost(s))
114+
.toArray(HttpHost[]::new);
115+
110116
Optional<BasicCredentialsProvider> basicCredentialsProvider = Optional.ofNullable(properties.getUsername())
111117
.map(username -> createBasicCredentialsProvider(httpHosts, username, properties.getPassword()));
112118

0 commit comments

Comments
 (0)