You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/elasticsearch.adoc
+67-58Lines changed: 67 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -37,33 +37,12 @@ dependencies {
37
37
38
38
TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file.
39
39
40
-
Please have a look at the list of <<elasticsearchvector-properties,configuration parameters>> for the vector store to learn about the default values and configuration options.
41
-
42
-
Here is an example of the needed bean:
40
+
TIP: Refer to the xref:getting-started.adoc#repositories[Repositories] section to add Milestone and/or Snapshot Repositories to your build file.
43
41
44
-
[source,java]
45
-
----
46
-
@Bean
47
-
public EmbeddingClient embeddingCLient() {
48
-
// Can be any other EmbeddingClient implementation
49
-
return new OpenAiEmbeddingClient(new OpenAiApi(System.getenv("SPRING_AI_OPENAI_API_KEY")));
50
-
}
51
-
----
42
+
Please have a look at the list of <<elasticsearchvector-properties,configuration parameters>> for the vector store to learn about the default values and configuration options.
52
43
53
-
In cases where the Spring Boot auto-configured Elasticsearch `RestClient` bean is not what you want or need, you can still define your own bean.
54
-
Please read the link:https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-initialization.html[Elasticsearch Documentation]
55
-
for more in-depth information about the configuration of a custom RestClient.
44
+
Additionally, you will need a configured `EmbeddingClient` bean. Refer to the xref:api/embeddings.adoc#available-implementations[EmbeddingClient] section for more information.
| `spring.elasticsearch.socket-keep-alive` | Whether to enable socket keep alive between client and Elasticsearch. | `false`
119
+
| `spring.elasticsearch.socket-timeout` | Socket timeout used when communicating with Elasticsearch. | `30s`
141
120
|===
142
121
143
-
144
-
The properties with `spring.ai.vectorstore.elasticsearch.*` prefix help to configure Elasticsearch vector store.
122
+
Properties starting with the `spring.ai.vectorstore.elasticsearch.*` prefix are used to configure `ElasticsearchVectorStore`.
145
123
146
124
|===
147
125
|Property | Description | Default Value
@@ -152,30 +130,9 @@ The properties with `spring.ai.vectorstore.elasticsearch.*` prefix help to confi
152
130
|`spring.ai.vectorstore.elasticsearch.similarity` | The similarity function to use. | `cosine`
153
131
|===
154
132
155
-
=== Manual Configuration
156
-
157
-
Instead of using the Spring Boot auto-configuration, you can manually configure the Elasticsearch vector store. \For this you need to add the `spring-ai-elasticsearch-store` to your project:
You can leverage the generic, portable xref:api/vectordbs.adoc#metadata-filters[metadata filters] with Elasticsearcg as well.
135
+
You can leverage the generic, portable xref:api/vectordbs.adoc#metadata-filters[metadata filters] with Elasticsearch as well.
179
136
180
137
For example, you can use either the text expression language:
181
138
@@ -219,3 +176,55 @@ is converted into the proprietary Elasticsearch filter format:
219
176
(metadata.author:john OR jill) AND metadata.article_type:blog
220
177
----
221
178
179
+
== Manual Configuration
180
+
181
+
Instead of using the Spring Boot auto-configuration, you can manually configure the Elasticsearch vector store. \For this you need to add the `spring-ai-elasticsearch-store` to your project:
Read the link:https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-initialization.html[Elasticsearch Documentation] for more in-depth information about the configuration of a custom RestClient.
Copy file name to clipboardExpand all lines: spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/vectorstore/elasticsearch/ElasticsearchVectorStoreAutoConfiguration.java
0 commit comments