fabriziofortino commented on code in PR #1646:
URL: https://github.com/apache/jackrabbit-oak/pull/1646#discussion_r1718230023
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/ElasticRequestHandler.java:
##########
@@ -191,8 +193,6 @@ public BoolQuery.Builder baseQueryBuilder() {
} else {
bqb.must(m -> m.moreLikeThis(mltQuery(mltParams)));
}
- } else {
- bqb.must(m -> m.bool(similarityQuery(queryNodePath, sp)));
Review Comment:
the knn query should be part of the base query to be sure all scenarios are
covered.
This documentation here explains how to do that
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-knn-query.html
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java:
##########
@@ -283,20 +278,13 @@ private static void mapIndexRules(@NotNull
TypeMapping.Builder builder,
ElasticPropertyDefinition pd = (ElasticPropertyDefinition)
propertyDefinition;
int denseVectorSize = pd.getSimilaritySearchDenseVectorSize();
- Reader eknnConfig = new StringReader(
- "{" +
- " \"type\":
\"elastiknn_dense_float_vector\"," +
- " \"elastiknn\": {" +
- " \"dims\": " + denseVectorSize + "," +
- " \"model\": \"lsh\"," +
- " \"similarity\": \"" +
pd.getSimilaritySearchParameters().getIndexTimeSimilarityFunction() + "\"," +
- " \"L\": " +
pd.getSimilaritySearchParameters().getL() + "," +
- " \"k\": " +
pd.getSimilaritySearchParameters().getK() + "," +
- " \"w\": " +
pd.getSimilaritySearchParameters().getW() +
- " }" +
- "}");
+ DenseVectorProperty denseVectorProperty = new
DenseVectorProperty.Builder()
+ .index(true)
+ .dims(denseVectorSize)
+ .similarity("l2_norm")
Review Comment:
This should be configurable. See
`ElasticPropertyDefinition#similaritySearchParameters`.
The current parameters are related to elastiknn. We should rework them and
support the ones user by ES dense vectors, including index_options.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]