Update Elasticsearch Store: Use KNN insettad of script_score
- knn instead of script_score, removed initialization - only using normalized similarities, adjusted unit test - making l2norm's distances consistent with others - update dependency version and docs - upate autoconfigure ITs
This commit is contained in:
committed by
Christian Tzolov
parent
c9dd336ea3
commit
78f3797f8d
@@ -134,11 +134,18 @@ Properties starting with the `spring.ai.vectorstore.elasticsearch.*` prefix are
|
||||
|
||||
|`spring.ai.vectorstore.elasticsearch.index-name` | The name of the index to store the vectors. | spring-ai-document-index
|
||||
|`spring.ai.vectorstore.elasticsearch.dimensions` | The number of dimensions in the vector. | 1536
|
||||
|`spring.ai.vectorstore.elasticsearch.dense-vector-indexing` | Whether to use dense vector indexing. | true
|
||||
|`spring.ai.vectorstore.elasticsearch.similarity` | The similarity function to use. | `cosine`
|
||||
|`spring.ai.vectorstore.elasticsearch.initialize-schema`| whether to initialize the required schema | `false`
|
||||
|===
|
||||
|
||||
The following similarity functions are available:
|
||||
|
||||
* cosine
|
||||
* l2_norm
|
||||
* dot_product
|
||||
|
||||
More details about each in the https://www.elastic.co/guide/en/elasticsearch/reference/master/dense-vector.html#dense-vector-params[Elasticsearch Documentation] on dense vectors.
|
||||
|
||||
== Metadata Filtering
|
||||
|
||||
You can leverage the generic, portable xref:api/vectordbs.adoc#metadata-filters[metadata filters] with Elasticsearch as well.
|
||||
@@ -214,10 +221,11 @@ Read the link:https://www.elastic.co/guide/en/elasticsearch/client/java-api-clie
|
||||
----
|
||||
@Bean
|
||||
public RestClient restClient() {
|
||||
RestClientBuilder builder = RestClient.builder(new HttpHost("<host>", 9200, "http"));
|
||||
Header[] defaultHeaders = new Header[] { new BasicHeader("Authorization", "Basic <encoded username and password>") };
|
||||
builder.setDefaultHeaders(defaultHeaders);
|
||||
return builder.build();
|
||||
RestClient.builder(new HttpHost("<host>", 9200, "http"))
|
||||
.setDefaultHeaders(new Header[]{
|
||||
new BasicHeader("Authorization", "Basic <encoded username and password>")
|
||||
})
|
||||
.build();
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user