@@ -17,6 +17,10 @@ embeddings stored by the `OpenSearchVectorStore`.
17
17
18
18
Add the OpenSearch Vector Store dependency to your project:
19
19
20
+ [tabs]
21
+ ======
22
+ Maven::
23
+ +
20
24
[source,xml]
21
25
----
22
26
<dependency>
@@ -25,14 +29,15 @@ Add the OpenSearch Vector Store dependency to your project:
25
29
</dependency>
26
30
----
27
31
28
- or to your Gradle `build.gradle` build file.
29
-
32
+ Gradle::
33
+ +
30
34
[source,groovy]
31
35
----
32
36
dependencies {
33
37
implementation 'org.springframework.ai:spring-ai-opensearch-store'
34
38
}
35
39
----
40
+ ======
36
41
37
42
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
38
43
@@ -66,9 +71,15 @@ TIP: Check the list of xref:#_configuration_properties[configuration parameters]
66
71
67
72
== Auto-configuration
68
73
74
+ === Self-Managed OpenSearch
75
+
69
76
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 :
71
78
79
+ [tabs]
80
+ ======
81
+ Maven::
82
+ +
72
83
[source,xml]
73
84
----
74
85
<dependency>
@@ -77,14 +88,45 @@ To enable it, add the following dependency to your project's Maven `pom.xml` fil
77
88
</dependency>
78
89
----
79
90
80
- or to your Gradle `build.gradle` build file.
81
-
91
+ Gradle::
92
+ +
82
93
[source,groovy]
83
94
----
84
95
dependencies {
85
96
implementation 'org.springframework.ai:spring-ai-opensearch-store-spring-boot-starter'
86
97
}
87
98
----
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.
88
130
89
131
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
90
132
@@ -154,32 +196,16 @@ In cases where the Spring Boot auto-configured OpenSearchClient with `Apache Htt
154
196
you want or need, you can still define your own bean.
155
197
Please read the link:https://opensearch.org/docs/latest/clients/java/[OpenSearch Java Client Documentation]
156
198
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
-
177
199
== Metadata Filtering
178
200
179
201
You can leverage the generic, portable xref:api/vectordbs.adoc#metadata-filters[metadata filters] with OpenSearch as well.
180
202
181
203
For example, you can use either the text expression language:
182
204
205
+ [tabs]
206
+ ======
207
+ SQL filter syntax::
208
+ +
183
209
[source,java]
184
210
----
185
211
vectorStore.similaritySearch(SearchRequest.defaults()
@@ -189,8 +215,8 @@ vectorStore.similaritySearch(SearchRequest.defaults()
189
215
.withFilterExpression("author in ['john', 'jill'] && 'article_type' == 'blog'"));
190
216
----
191
217
192
- or programmatically using the `Filter.Expression` DSL:
193
-
218
+ `Filter.Expression` DSL: :
219
+ +
194
220
[source,java]
195
221
----
196
222
FilterExpressionBuilder b = new FilterExpressionBuilder();
@@ -203,6 +229,7 @@ vectorStore.similaritySearch(SearchRequest.defaults()
203
229
b.in("john", "jill"),
204
230
b.eq("article_type", "blog")).build()));
205
231
----
232
+ ======
206
233
207
234
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].
208
235
0 commit comments