Following the walkthrough in spring ai documenation for opensearch vector store on aws, the following properties are incorrectly located:

spring.opensearch.aws.host spring.opensearch.aws.service-name spring.opensearch.aws.access-key spring.opensearch.aws.secret-key spring.opensearch.aws.region

these only work if located on spring.ai.vectorstore.opensearch.*

else causes error: Caused by: java.lang.NullPointerException: Access key ID cannot be blank.

Also similarity search for index with the following json mapping gives: Similarity search results with error: org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [search_phase_execution_exception] all shards failed

for mapping json: mappingJson: | "properties": { "embedding": { "type": "knn_vector", "dimension": 1536 } }

Comment From: garc33

I had exactly the same issue. I fixed it by disabling the json indentation in Jackson ObjectMapper.

Comment From: tstephen1

I had exactly the same issue. I fixed it by disabling the json indentation in Jackson ObjectMapper.

I tried this but it didnt work -

spring: jackson: serialization: indent_output: false

Could you give an example?

Comment From: tzolov

@garc33 @tstephen1 does the updated docs helps your resolve the issue? https://docs.spring.io/spring-ai/reference/api/vectordbs/opensearch.html (refresh the page).

Comment From: tstephen1

@tzolov @garc33 - the updated docs change, adding documents to aws openseach works fine. But similarity search still causes error:

org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [search_phase_execution_exception] all shards failed

Updating the object mapper with indent output to false as suggested above : objectMapper.configure(SerializationFeature.INDENT_OUTPUT, false);

generates this error when using ollama embedding model:

2024-10-25T14:27:04.111+01:00 DEBUG 11139 --- h.i.i.PoolingHttpClientConnectionManager : ep-0000000001 connection released [route: {}->http://localhost:11434][total available: 1; route allocated: 1 of 5; total allocated: 1 of 25] 2024-10-25T14:27:04.212+01:00 DEBUG 11139 --- o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'text/plain', given [/] and supported [text/plain, /, application/json, application/*+json] 2024-10-25T14:27:04.214+01:00 DEBUG 11139 --- o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing ["Failed to save text: Error while extracting response for type [org.springframework.ai.ollama.api.Oll (truncated)..."]