Skip to content

Commit b6222d4

Browse files
committed
Improve the OpenSearch doc structure
1 parent e9b70f4 commit b6222d4

File tree

1 file changed

+54
-27
lines changed
  • spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs

1 file changed

+54
-27
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/opensearch.adoc

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ embeddings stored by the `OpenSearchVectorStore`.
1717

1818
Add the OpenSearch Vector Store dependency to your project:
1919

20+
[tabs]
21+
======
22+
Maven::
23+
+
2024
[source,xml]
2125
----
2226
<dependency>
@@ -25,14 +29,15 @@ Add the OpenSearch Vector Store dependency to your project:
2529
</dependency>
2630
----
2731
28-
or to your Gradle `build.gradle` build file.
29-
32+
Gradle::
33+
+
3034
[source,groovy]
3135
----
3236
dependencies {
3337
implementation 'org.springframework.ai:spring-ai-opensearch-store'
3438
}
3539
----
40+
======
3641

3742
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
3843

@@ -66,9 +71,15 @@ TIP: Check the list of xref:#_configuration_properties[configuration parameters]
6671

6772
== Auto-configuration
6873

74+
=== Self-Managed OpenSearch
75+
6976
Spring AI provides Spring Boot auto-configuration for the OpenSearch Vector Store.
70-
To enable it, add the following dependency to your project's Maven `pom.xml` file:
77+
To enable it, add the following dependency to your project's Maven `pom.xml` or Gradle `build.gradle` build files:
7178

79+
[tabs]
80+
======
81+
Maven::
82+
+
7283
[source,xml]
7384
----
7485
<dependency>
@@ -77,14 +88,45 @@ To enable it, add the following dependency to your project's Maven `pom.xml` fil
7788
</dependency>
7889
----
7990
80-
or to your Gradle `build.gradle` build file.
81-
91+
Gradle::
92+
+
8293
[source,groovy]
8394
----
8495
dependencies {
8596
implementation 'org.springframework.ai:spring-ai-opensearch-store-spring-boot-starter'
8697
}
8798
----
99+
======
100+
101+
Then use the `spring.ai.vectorstore.opensearch.*` properties to configure the connection to the self-managed OpenSearch instance.
102+
103+
=== Amazon OpenSearch Service
104+
105+
To enable Amazon OpenSearch Service., add the following dependency to your project's Maven `pom.xml` or Gradle `build.gradle` build files:
106+
107+
[tabs]
108+
======
109+
Maven::
110+
+
111+
[source,xml]
112+
----
113+
<dependency>
114+
<groupId>org.springframework.ai</groupId>
115+
<artifactId>spring-ai-aws-opensearch-store-spring-boot-starter</artifactId>
116+
</dependency>
117+
----
118+
119+
Gradle::
120+
+
121+
[source,groovy]
122+
----
123+
dependencies {
124+
implementation 'org.springframework.ai:spring-ai-aws-opensearch-store-spring-boot-starter'
125+
}
126+
----
127+
======
128+
129+
Then use the `spring.ai.vectorstore.opensearch.aws.*` properties to configure the connection to the Amazon OpenSearch Service.
88130

89131
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
90132

@@ -154,32 +196,16 @@ In cases where the Spring Boot auto-configured OpenSearchClient with `Apache Htt
154196
you want or need, you can still define your own bean.
155197
Please read the link:https://opensearch.org/docs/latest/clients/java/[OpenSearch Java Client Documentation]
156198

157-
for more in-depth information about the configuration of Amazon OpenSearch Service.
158-
To enable it, add the following dependency to your project's Maven `pom.xml` file:
159-
160-
[source,xml]
161-
----
162-
<dependency>
163-
<groupId>org.springframework.ai</groupId>
164-
<artifactId>spring-ai-aws-opensearch-store-spring-boot-starter</artifactId>
165-
</dependency>
166-
----
167-
168-
or to your Gradle `build.gradle` build file.
169-
170-
[source,groovy]
171-
----
172-
dependencies {
173-
implementation 'org.springframework.ai:spring-ai-aws-opensearch-store-spring-boot-starter'
174-
}
175-
----
176-
177199
== Metadata Filtering
178200

179201
You can leverage the generic, portable xref:api/vectordbs.adoc#metadata-filters[metadata filters] with OpenSearch as well.
180202

181203
For example, you can use either the text expression language:
182204

205+
[tabs]
206+
======
207+
SQL filter syntax::
208+
+
183209
[source,java]
184210
----
185211
vectorStore.similaritySearch(SearchRequest.defaults()
@@ -189,8 +215,8 @@ vectorStore.similaritySearch(SearchRequest.defaults()
189215
.withFilterExpression("author in ['john', 'jill'] && 'article_type' == 'blog'"));
190216
----
191217
192-
or programmatically using the `Filter.Expression` DSL:
193-
218+
`Filter.Expression` DSL::
219+
+
194220
[source,java]
195221
----
196222
FilterExpressionBuilder b = new FilterExpressionBuilder();
@@ -203,6 +229,7 @@ vectorStore.similaritySearch(SearchRequest.defaults()
203229
b.in("john", "jill"),
204230
b.eq("article_type", "blog")).build()));
205231
----
232+
======
206233

207234
NOTE: Those (portable) filter expressions get automatically converted into the proprietary OpenSearch link:https://opensearch.org/docs/latest/query-dsl/full-text/query-string/[Query string query].
208235

0 commit comments

Comments
 (0)