Improve OpenSearch AWS/non-AWS auto-configuration and document fallback logic
- Add OpenSearchNonAwsCondition to robustly activate non-AWS OpenSearch auto-configuration if either:
- AWS SDK classes are missing, OR
- spring.ai.vectorstore.opensearch.aws.enabled=false
- Update OpenSearchVectorStoreAutoConfiguration to use the new condition for non-AWS configuration.
- Ensure AWS-specific auto-configuration is only active when AWS SDKs are present and the property is true (default).
- Add Javadoc to OpenSearchNonAwsCondition and clarify Javadoc on AWS config.
- Update integration test (OpenSearchVectorStoreNonAwsFallbackIT) to verify fallback logic works with AWS SDKs present.
- Add and refine documentation in opensearch.adoc:
- Explain the purpose and usage of the spring.ai.vectorstore.opensearch.aws.enabled property.
- Document the fallback logic and how to explicitly select AWS or non-AWS OpenSearch support.
Fixes #1901
Signed-off-by: Mark Pollack <mark.pollack@broadcom.com>
This commit is contained in:
@@ -130,6 +130,18 @@ Properties starting with `spring.ai.vectorstore.opensearch.*` are used to config
|
||||
|`spring.ai.vectorstore.opensearch.aws.region`| AWS region | -
|
||||
|===
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
You can control whether the AWS-specific OpenSearch auto-configuration is enabled using the `spring.ai.vectorstore.opensearch.aws.enabled` property.
|
||||
|
||||
- If this property is set to `false`, the non-AWS OpenSearch configuration is activated, even if AWS SDK classes are present on the classpath. This allows you to use self-managed or third-party OpenSearch clusters in environments where AWS SDKs are present for other services.
|
||||
- If AWS SDK classes are not present, the non-AWS configuration is always used.
|
||||
- If AWS SDK classes are present and the property is not set or set to `true`, the AWS-specific configuration is used by default.
|
||||
|
||||
This fallback logic ensures that users have explicit control over the type of OpenSearch integration, preventing accidental activation of AWS-specific logic when not desired.
|
||||
====
|
||||
|
||||
|
||||
The following similarity functions are available:
|
||||
|
||||
* `cosinesimil` - Default, suitable for most use cases. Measures cosine similarity between vectors.
|
||||
|
||||
Reference in New Issue
Block a user