This is an automated email from the ASF dual-hosted git repository.

fortino pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 03ee9abdb7 OAK-11730 bump elasticsearch version to 8.18.1 / lucene 
9.12.1 (#2298)
03ee9abdb7 is described below

commit 03ee9abdb7c9b49be752d48c0784aec24e449d36
Author: Fabrizio Fortino <[email protected]>
AuthorDate: Thu May 29 08:41:24 2025 +0200

    OAK-11730 bump elasticsearch version to 8.18.1 / lucene 9.12.1 (#2298)
    
    * OAK-11730 bump elasticsearch version to 8.18.1 / lucene 9.12.1
    
    * increase max.jar.size in oak-run-elastic
---
 oak-run-elastic/pom.xml                                    |  2 +-
 oak-search-elastic/pom.xml                                 |  4 ++--
 .../plugins/index/elastic/index/ElasticIndexHelper.java    | 14 +++++++++++---
 .../oak/plugins/index/elastic/ElasticSimilarQueryTest.java |  2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/oak-run-elastic/pom.xml b/oak-run-elastic/pom.xml
index f3dec721fd..1eff66c655 100644
--- a/oak-run-elastic/pom.xml
+++ b/oak-run-elastic/pom.xml
@@ -42,7 +42,7 @@
         105 MB: Azure updates
         107 MB: RDB/Tomcat (OAK-10752)
         -->
-        <max.jar.size>115000000</max.jar.size>
+        <max.jar.size>116000000</max.jar.size>
                       
     </properties>
 
diff --git a/oak-search-elastic/pom.xml b/oak-search-elastic/pom.xml
index e9fa930b6e..3075011978 100644
--- a/oak-search-elastic/pom.xml
+++ b/oak-search-elastic/pom.xml
@@ -33,8 +33,8 @@
   <description>Oak Elasticsearch integration subproject</description>
 
   <properties>
-    
<elasticsearch.java.client.version>8.17.2</elasticsearch.java.client.version>
-    <lucene.version>9.12.0</lucene.version>
+    
<elasticsearch.java.client.version>8.18.1</elasticsearch.java.client.version>
+    <lucene.version>9.12.1</lucene.version>
   </properties>
 
   <build>
diff --git 
a/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java
 
b/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java
index cef13f63fa..b0ef9817b4 100644
--- 
a/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java
+++ 
b/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexHelper.java
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.plugins.index.elastic.index;
 
 import co.elastic.clients.elasticsearch._types.Time;
 import co.elastic.clients.elasticsearch._types.mapping.DenseVectorProperty;
+import co.elastic.clients.elasticsearch._types.mapping.DenseVectorSimilarity;
 import co.elastic.clients.elasticsearch._types.mapping.DynamicMapping;
 import co.elastic.clients.elasticsearch._types.mapping.Property;
 import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
@@ -57,6 +58,7 @@ import java.io.StringReader;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 import static 
org.apache.jackrabbit.oak.plugins.index.elastic.ElasticPropertyDefinition.DEFAULT_SIMILARITY_METRIC;
@@ -218,7 +220,10 @@ class ElasticIndexHelper {
                             .properties("value", pb -> pb.denseVector(dv ->
                                             dv.index(true)
                                                     .dims(p.dims)
-                                                    .similarity(p.similarity)
+                                                    .similarity(
+                                                            
Arrays.stream(DenseVectorSimilarity.values()).filter(s ->
+                                                                    
Objects.equals(s.jsonValue(), p.similarity)).findAny().orElseThrow()
+                                                    )
                                     )
                             )
                             .properties("metadata", pb -> pb.flattened(b1 -> 
b1))
@@ -276,7 +281,7 @@ class ElasticIndexHelper {
         analyzerBuilder.filter("shingle",
                 tokenFilter -> tokenFilter.definition(
                         tokenFilterDef -> tokenFilterDef.shingle(
-                                shingle -> 
shingle.minShingleSize("2").maxShingleSize("3"))));
+                                shingle -> 
shingle.minShingleSize(2).maxShingleSize(3))));
         analyzerBuilder.analyzer("trigram",
                 ab -> ab.custom(
                         customAnalyzer -> 
customAnalyzer.tokenizer("standard").filter("lowercase", "shingle")));
@@ -368,7 +373,10 @@ class ElasticIndexHelper {
                 DenseVectorProperty denseVectorProperty = new 
DenseVectorProperty.Builder()
                         .index(true)
                         .dims(denseVectorSize)
-                        .similarity(DEFAULT_SIMILARITY_METRIC)
+                        .similarity(
+                                
Arrays.stream(DenseVectorSimilarity.values()).filter(s ->
+                                        Objects.equals(s.jsonValue(), 
DEFAULT_SIMILARITY_METRIC)).findAny().orElseThrow()
+                        )
                         .build();
 
                 builder.properties(FieldNames.createSimilarityFieldName(
diff --git 
a/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticSimilarQueryTest.java
 
b/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticSimilarQueryTest.java
index 575b55d2f0..1f7d67fd5b 100644
--- 
a/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticSimilarQueryTest.java
+++ 
b/oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticSimilarQueryTest.java
@@ -199,7 +199,7 @@ public class ElasticSimilarQueryTest extends 
ElasticAbstractQueryTest {
         Property v = 
typeFieldMappings.get(similarityFieldName1).mapping().get(similarityFieldName1);
         DenseVectorProperty denseVector = v.denseVector();
         assertEquals("Dense vector size doesn't match", 2048, 
denseVector.dims().intValue());
-        assertEquals("Similarity metric doesn't match", "l2_norm", 
denseVector.similarity());
+        assertEquals("Similarity metric doesn't match", "l2_norm", 
denseVector.similarity().jsonValue());
     }
 
     @Test

Reply via email to