Skip to content

Commit 4d6e6b7

Browse files
authored
Merge branch 'main' into esql-mv-rerank
2 parents 5189c0e + 2f44948 commit 4d6e6b7

File tree

172 files changed

+208071
-1710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+208071
-1710
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/scorer/VectorScorerFloat32OperationBenchmark.java

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.lang.foreign.Arena;
3232
import java.lang.foreign.MemorySegment;
3333
import java.lang.foreign.ValueLayout;
34+
import java.lang.invoke.MethodHandle;
3435
import java.nio.ByteOrder;
3536
import java.util.concurrent.ThreadLocalRandom;
3637
import java.util.concurrent.TimeUnit;
@@ -72,13 +73,8 @@ private interface LuceneFunction {
7273
float run(float[] vec1, float[] vec2);
7374
}
7475

75-
@FunctionalInterface
76-
private interface NativeFunction {
77-
float run(MemorySegment vec1, MemorySegment vec2, int length);
78-
}
79-
8076
private LuceneFunction luceneImpl;
81-
private NativeFunction nativeImpl;
77+
private MethodHandle nativeImpl;
8278

8379
@Setup(Level.Iteration)
8480
public void init() {
@@ -105,11 +101,11 @@ public void init() {
105101
case EUCLIDEAN -> VectorUtil::squareDistance;
106102
default -> throw new UnsupportedOperationException("Not used");
107103
};
108-
nativeImpl = switch (function) {
109-
case DOT_PRODUCT -> VectorScorerFloat32OperationBenchmark::dotProductFloat32;
110-
case EUCLIDEAN -> VectorScorerFloat32OperationBenchmark::squareDistanceFloat32;
111-
default -> throw new UnsupportedOperationException("Not used");
112-
};
104+
nativeImpl = vectorSimilarityFunctions.getHandle(switch (function) {
105+
case DOT_PRODUCT -> VectorSimilarityFunctions.Function.DOT_PRODUCT;
106+
case EUCLIDEAN -> VectorSimilarityFunctions.Function.SQUARE_DISTANCE;
107+
default -> throw new IllegalArgumentException(function.toString());
108+
}, VectorSimilarityFunctions.DataType.FLOAT32, VectorSimilarityFunctions.Operation.SINGLE);
113109
}
114110

115111
@TearDown
@@ -131,29 +127,21 @@ public float luceneWithCopy() {
131127

132128
@Benchmark
133129
public float nativeWithNativeSeg() {
134-
return nativeImpl.run(nativeSegA, nativeSegB, size);
130+
try {
131+
return (float) nativeImpl.invokeExact(nativeSegA, nativeSegB, size);
132+
} catch (Throwable t) {
133+
throw rethrow(t);
134+
}
135135
}
136136

137137
@Benchmark
138138
public float nativeWithHeapSeg() {
139-
return nativeImpl.run(heapSegA, heapSegB, size);
140-
}
141-
142-
static final VectorSimilarityFunctions vectorSimilarityFunctions = NativeAccess.instance().getVectorSimilarityFunctions().orElseThrow();
143-
144-
static float dotProductFloat32(MemorySegment a, MemorySegment b, int length) {
145139
try {
146-
return (float) vectorSimilarityFunctions.dotProductHandleFloat32().invokeExact(a, b, length);
147-
} catch (Throwable e) {
148-
throw rethrow(e);
140+
return (float) nativeImpl.invokeExact(heapSegA, heapSegB, size);
141+
} catch (Throwable t) {
142+
throw rethrow(t);
149143
}
150144
}
151145

152-
static float squareDistanceFloat32(MemorySegment a, MemorySegment b, int length) {
153-
try {
154-
return (float) vectorSimilarityFunctions.squareDistanceHandleFloat32().invokeExact(a, b, length);
155-
} catch (Throwable e) {
156-
throw rethrow(e);
157-
}
158-
}
146+
static final VectorSimilarityFunctions vectorSimilarityFunctions = NativeAccess.instance().getVectorSimilarityFunctions().orElseThrow();
159147
}

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/scorer/VectorScorerInt7uOperationBenchmark.java

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import java.lang.foreign.Arena;
3232
import java.lang.foreign.MemorySegment;
33+
import java.lang.invoke.MethodHandle;
3334
import java.util.concurrent.TimeUnit;
3435

3536
import static org.elasticsearch.benchmark.vector.scorer.BenchmarkUtils.randomInt7BytesBetween;
@@ -67,13 +68,8 @@ private interface LuceneFunction {
6768
float run(byte[] vec1, byte[] vec2);
6869
}
6970

70-
@FunctionalInterface
71-
private interface NativeFunction {
72-
float run(MemorySegment vec1, MemorySegment vec2, int length);
73-
}
74-
7571
private LuceneFunction luceneImpl;
76-
private NativeFunction nativeImpl;
72+
private MethodHandle nativeImpl;
7773

7874
@Setup(Level.Iteration)
7975
public void init() {
@@ -97,11 +93,11 @@ public void init() {
9793
case EUCLIDEAN -> VectorUtil::squareDistance;
9894
default -> throw new UnsupportedOperationException("Not used");
9995
};
100-
nativeImpl = switch (function) {
101-
case DOT_PRODUCT -> VectorScorerInt7uOperationBenchmark::dotProduct7u;
102-
case EUCLIDEAN -> VectorScorerInt7uOperationBenchmark::squareDistance7u;
103-
default -> throw new UnsupportedOperationException("Not used");
104-
};
96+
nativeImpl = vectorSimilarityFunctions.getHandle(switch (function) {
97+
case DOT_PRODUCT -> VectorSimilarityFunctions.Function.DOT_PRODUCT;
98+
case EUCLIDEAN -> VectorSimilarityFunctions.Function.SQUARE_DISTANCE;
99+
default -> throw new IllegalArgumentException(function.toString());
100+
}, VectorSimilarityFunctions.DataType.INT7, VectorSimilarityFunctions.Operation.SINGLE);
105101
}
106102

107103
@TearDown
@@ -115,30 +111,22 @@ public float lucene() {
115111
}
116112

117113
@Benchmark
118-
public float nativeWithNativeSeg() {
119-
return nativeImpl.run(nativeSegA, nativeSegB, size);
114+
public int nativeWithNativeSeg() {
115+
try {
116+
return (int) nativeImpl.invokeExact(nativeSegA, nativeSegB, size);
117+
} catch (Throwable t) {
118+
throw rethrow(t);
119+
}
120120
}
121121

122122
@Benchmark
123123
public float nativeWithHeapSeg() {
124-
return nativeImpl.run(heapSegA, heapSegB, size);
125-
}
126-
127-
static final VectorSimilarityFunctions vectorSimilarityFunctions = NativeAccess.instance().getVectorSimilarityFunctions().orElseThrow();
128-
129-
static int dotProduct7u(MemorySegment a, MemorySegment b, int length) {
130124
try {
131-
return (int) vectorSimilarityFunctions.dotProductHandle7u().invokeExact(a, b, length);
132-
} catch (Throwable e) {
133-
throw rethrow(e);
125+
return (int) nativeImpl.invokeExact(heapSegA, heapSegB, size);
126+
} catch (Throwable t) {
127+
throw rethrow(t);
134128
}
135129
}
136130

137-
static int squareDistance7u(MemorySegment a, MemorySegment b, int length) {
138-
try {
139-
return (int) vectorSimilarityFunctions.squareDistanceHandle7u().invokeExact(a, b, length);
140-
} catch (Throwable e) {
141-
throw rethrow(e);
142-
}
143-
}
131+
static final VectorSimilarityFunctions vectorSimilarityFunctions = NativeAccess.instance().getVectorSimilarityFunctions().orElseThrow();
144132
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ private List<File> resolveProjectLogs(File projectDir) {
114114
Files.walkFileTree(projectDir.toPath(), new SimpleFileVisitor<>() {
115115
@Override
116116
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
117-
if (Files.isSymbolicLink(file)) {
118-
Files.delete(file);
117+
try {
118+
if (Files.isSymbolicLink(file)) {
119+
Files.delete(file);
120+
}
121+
} catch (java.nio.file.NoSuchFileException e) {
122+
System.out.println("Symlink : " + file + " already deleted.");
119123
}
120124
return FileVisitResult.CONTINUE;
121125
}

build-tools-internal/version.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ecsLogging = 1.7.0
1616
jna = 5.12.1
1717
netty = 4.1.130.Final
1818
commons_lang3 = 3.9
19+
commons_math3 = 3.6.1
1920
google_oauth_client = 1.34.1
2021
awsv2sdk = 2.31.78
2122
reactive_streams = 1.0.4

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ allprojects {
342342
if (project.path == ':') {
343343
resolveJavaToolChain = true
344344
}
345+
project.pluginManager.withPlugin('elasticsearch.mrjar') {
346+
// ensure we implicitly resolve all jdks needed from the java toolchain resolution
347+
println "Configuring resolveAllDependencies to depend on JavaCompile tasks for project ${project.path} because it applies the mrjar plugin"
348+
dependsOn project.getTasks().withType(JavaCompile.class)
349+
}
345350
// we run the packer script for all active branches. so we should be able to skip bwc here
346351
if(project.path.startsWith(":distribution:bwc:")) {
347352
enabled = false

distribution/docker/src/docker/dockerfiles/cloud_ess_fips/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Extract Elasticsearch artifact
2626
################################################################################
2727
28-
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest@sha256:c756ffe412df1a84c87d474ba90784e98484c1dc74500051770e67fbce456251 AS builder
28+
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest@sha256:11d66ae7ec7ca1d5a7289750bdd96eb3d8eb592e5b7377f1fc8e4fb556fa7383 AS builder
2929
3030
# Install required packages to extract the Elasticsearch distribution
3131
RUN <%= retry.loop(package_manager, "export DEBIAN_FRONTEND=noninteractive && ${package_manager} update && ${package_manager} update && ${package_manager} add --no-cache curl") %>
@@ -104,7 +104,7 @@ WORKDIR /usr/share/elasticsearch/config
104104
# Add entrypoint
105105
################################################################################
106106

107-
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest@sha256:c756ffe412df1a84c87d474ba90784e98484c1dc74500051770e67fbce456251
107+
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest@sha256:11d66ae7ec7ca1d5a7289750bdd96eb3d8eb592e5b7377f1fc8e4fb556fa7383
108108

109109
RUN <%= retry.loop(package_manager,
110110
"export DEBIAN_FRONTEND=noninteractive && \n" +

distribution/docker/src/docker/dockerfiles/wolfi/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Extract Elasticsearch artifact
2626
################################################################################
2727
28-
FROM docker.elastic.co/wolfi/chainguard-base:latest@sha256:2eae982b1ace31929369639fe4eefd38f3b12e85a5d5843f541c0cfc14045e27 AS builder
28+
FROM docker.elastic.co/wolfi/chainguard-base:latest@sha256:b5a03b6a754fa2f9a29e44e316a6c4df1f606cd8a3cd8810ce3d6a3a3134428b AS builder
2929
3030
# Install required packages to extract the Elasticsearch distribution
3131
RUN <%= retry.loop(package_manager, "export DEBIAN_FRONTEND=noninteractive && ${package_manager} update && ${package_manager} update && ${package_manager} add --no-cache curl") %>
@@ -80,7 +80,7 @@ RUN sed -i -e 's/ES_DISTRIBUTION_TYPE=tar/ES_DISTRIBUTION_TYPE=docker/' bin/elas
8080
# Add entrypoint
8181
################################################################################
8282

83-
FROM docker.elastic.co/wolfi/chainguard-base:latest@sha256:2eae982b1ace31929369639fe4eefd38f3b12e85a5d5843f541c0cfc14045e27
83+
FROM docker.elastic.co/wolfi/chainguard-base:latest@sha256:b5a03b6a754fa2f9a29e44e316a6c4df1f606cd8a3cd8810ce3d6a3a3134428b
8484

8585
RUN <%= retry.loop(package_manager,
8686
"export DEBIAN_FRONTEND=noninteractive && \n" +

docs/changelog/131828.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 131828
2+
summary: ES|QL approximate analytical queries
3+
area: ES|QL
4+
type: feature
5+
issues: []

docs/changelog/139422.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 139422
2+
summary: Use common retry logic for Azure
3+
area: Snapshot/Restore
4+
type: enhancement
5+
issues: []

docs/changelog/139944.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 139944
2+
summary: Make quantization level of indexed vectors for 'bbq_disk' configurable
3+
area: Vector Search
4+
type: enhancement
5+
issues: []

0 commit comments

Comments
 (0)