Skip to content

Commit 8725138

Browse files
authored
Merge branch 'main' into template-version
2 parents 0417ae9 + 469cd7d commit 8725138

File tree

935 files changed

+48543
-6485
lines changed

Some content is hidden

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

935 files changed

+48543
-6485
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/ValuesSourceReaderBenchmark.java

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.elasticsearch.cluster.metadata.IndexMetadata;
2727
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
2828
import org.elasticsearch.common.logging.LogConfigurator;
29-
import org.elasticsearch.common.lucene.Lucene;
3029
import org.elasticsearch.common.settings.Settings;
3130
import org.elasticsearch.common.unit.ByteSizeValue;
3231
import org.elasticsearch.common.util.BigArrays;
@@ -227,50 +226,44 @@ private static BlockLoader blockLoader(String name) {
227226
break;
228227
}
229228
ft.freeze();
230-
return new KeywordFieldMapper.KeywordFieldType(
231-
w.name,
232-
ft,
233-
Lucene.KEYWORD_ANALYZER,
234-
Lucene.KEYWORD_ANALYZER,
235-
Lucene.KEYWORD_ANALYZER,
236-
new KeywordFieldMapper.Builder(name, defaultIndexSettings()).docValues(ft.docValuesType() != DocValuesType.NONE),
237-
syntheticSource
238-
).blockLoader(new MappedFieldType.BlockLoaderContext() {
239-
@Override
240-
public String indexName() {
241-
return "benchmark";
242-
}
229+
return new KeywordFieldMapper.KeywordFieldType(w.name, ft, syntheticSource).blockLoader(
230+
new MappedFieldType.BlockLoaderContext() {
231+
@Override
232+
public String indexName() {
233+
return "benchmark";
234+
}
243235

244-
@Override
245-
public IndexSettings indexSettings() {
246-
throw new UnsupportedOperationException();
247-
}
236+
@Override
237+
public IndexSettings indexSettings() {
238+
throw new UnsupportedOperationException();
239+
}
248240

249-
@Override
250-
public MappedFieldType.FieldExtractPreference fieldExtractPreference() {
251-
return MappedFieldType.FieldExtractPreference.NONE;
252-
}
241+
@Override
242+
public MappedFieldType.FieldExtractPreference fieldExtractPreference() {
243+
return MappedFieldType.FieldExtractPreference.NONE;
244+
}
253245

254-
@Override
255-
public SearchLookup lookup() {
256-
throw new UnsupportedOperationException();
257-
}
246+
@Override
247+
public SearchLookup lookup() {
248+
throw new UnsupportedOperationException();
249+
}
258250

259-
@Override
260-
public Set<String> sourcePaths(String name) {
261-
return Set.of(name);
262-
}
251+
@Override
252+
public Set<String> sourcePaths(String name) {
253+
return Set.of(name);
254+
}
263255

264-
@Override
265-
public String parentField(String field) {
266-
throw new UnsupportedOperationException();
267-
}
256+
@Override
257+
public String parentField(String field) {
258+
throw new UnsupportedOperationException();
259+
}
268260

269-
@Override
270-
public FieldNamesFieldMapper.FieldNamesFieldType fieldNames() {
271-
return FieldNamesFieldMapper.FieldNamesFieldType.get(true);
261+
@Override
262+
public FieldNamesFieldMapper.FieldNamesFieldType fieldNames() {
263+
return FieldNamesFieldMapper.FieldNamesFieldType.get(true);
264+
}
272265
}
273-
});
266+
);
274267
}
275268
throw new IllegalArgumentException("can't read [" + name + "]");
276269
}

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
217217
);
218218
yield EvalMapper.toEvaluator(
219219
FOLD_CONTEXT,
220-
new DateTrunc(Source.EMPTY, new Literal(Source.EMPTY, Duration.ofHours(24), DataType.TIME_DURATION), timestamp),
220+
new DateTrunc(
221+
Source.EMPTY,
222+
new Literal(Source.EMPTY, Duration.ofHours(24), DataType.TIME_DURATION),
223+
timestamp,
224+
configuration()
225+
),
221226
layout(timestamp)
222227
).get(driverContext);
223228
}

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/OSQScorerBenchmark.java

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
import org.apache.lucene.util.quantization.OptimizedScalarQuantizer;
1919
import org.elasticsearch.common.logging.LogConfigurator;
2020
import org.elasticsearch.core.IOUtils;
21+
import org.elasticsearch.index.codec.vectors.diskbbq.next.ESNextDiskBBQVectorsFormat;
2122
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
23+
import org.elasticsearch.simdvec.ESNextOSQVectorsScorer;
2224
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
2325
import org.openjdk.jmh.annotations.Benchmark;
2426
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -57,6 +59,9 @@ public class OSQScorerBenchmark {
5759
@Param({ "384", "782", "1024" })
5860
int dims;
5961

62+
@Param({ "1", "2", "4" })
63+
int bits;
64+
6065
int length;
6166

6267
int numVectors = ES91OSQVectorsScorer.BULK_SIZE * 10;
@@ -68,8 +73,8 @@ public class OSQScorerBenchmark {
6873
float centroidDp;
6974

7075
byte[] scratch;
71-
ES91OSQVectorsScorer scorerMmap;
72-
ES91OSQVectorsScorer scorerNfios;
76+
ESNextOSQVectorsScorer scorerMmap;
77+
ESNextOSQVectorsScorer scorerNfios;
7378

7479
Directory dirMmap;
7580
IndexInput inMmap;
@@ -84,7 +89,12 @@ public class OSQScorerBenchmark {
8489
public void setup() throws IOException {
8590
Random random = new Random(123);
8691

87-
this.length = OptimizedScalarQuantizer.discretize(dims, 64) / 8;
92+
this.length = switch (bits) {
93+
case 1 -> ESNextDiskBBQVectorsFormat.QuantEncoding.ONE_BIT_4BIT_QUERY.getDocPackedLength(dims);
94+
case 2 -> ESNextDiskBBQVectorsFormat.QuantEncoding.TWO_BIT_4BIT_QUERY.getDocPackedLength(dims);
95+
case 4 -> ESNextDiskBBQVectorsFormat.QuantEncoding.FOUR_BIT_SYMMETRIC.getDocPackedLength(dims);
96+
default -> throw new IllegalArgumentException("Unsupported bits: " + bits);
97+
};
8898

8999
binaryVectors = new byte[numVectors][length];
90100
for (byte[] binaryVector : binaryVectors) {
@@ -109,8 +119,14 @@ public void setup() throws IOException {
109119
outNfios.close();
110120
inMmap = dirMmap.openInput("vectors", IOContext.DEFAULT);
111121
inNiofs = dirNiofs.openInput("vectors", IOContext.DEFAULT);
112-
113-
binaryQueries = new byte[numVectors][4 * length];
122+
int binaryQueryLength = switch (bits) {
123+
case 1 -> ESNextDiskBBQVectorsFormat.QuantEncoding.ONE_BIT_4BIT_QUERY.getQueryPackedLength(dims);
124+
case 2 -> ESNextDiskBBQVectorsFormat.QuantEncoding.TWO_BIT_4BIT_QUERY.getQueryPackedLength(dims);
125+
case 4 -> ESNextDiskBBQVectorsFormat.QuantEncoding.FOUR_BIT_SYMMETRIC.getQueryPackedLength(dims);
126+
default -> throw new IllegalArgumentException("Unsupported bits: " + bits);
127+
};
128+
129+
binaryQueries = new byte[numVectors][binaryQueryLength];
114130
for (byte[] binaryVector : binaryVectors) {
115131
random.nextBytes(binaryVector);
116132
}
@@ -123,8 +139,26 @@ public void setup() throws IOException {
123139
centroidDp = random.nextFloat();
124140

125141
scratch = new byte[length];
126-
scorerMmap = ESVectorizationProvider.getInstance().newES91OSQVectorsScorer(inMmap, dims);
127-
scorerNfios = ESVectorizationProvider.getInstance().newES91OSQVectorsScorer(inNiofs, dims);
142+
final int docBits;
143+
final int queryBits = switch (bits) {
144+
case 1 -> {
145+
docBits = 1;
146+
yield 4;
147+
}
148+
case 2 -> {
149+
docBits = 2;
150+
yield 4;
151+
}
152+
case 4 -> {
153+
docBits = 4;
154+
yield 4;
155+
}
156+
default -> throw new IllegalArgumentException("Unsupported bits: " + bits);
157+
};
158+
scorerMmap = ESVectorizationProvider.getInstance()
159+
.newESNextOSQVectorsScorer(inMmap, (byte) queryBits, (byte) docBits, dims, length);
160+
scorerNfios = ESVectorizationProvider.getInstance()
161+
.newESNextOSQVectorsScorer(inNiofs, (byte) queryBits, (byte) docBits, dims, length);
128162
scratchScores = new float[16];
129163
corrections = new float[3];
130164
}
@@ -156,7 +190,7 @@ public void scoreFromMemorySegmentOnlyVectorNiofsVect(Blackhole bh) throws IOExc
156190
scoreFromMemorySegmentOnlyVector(bh, inNiofs, scorerNfios);
157191
}
158192

159-
private void scoreFromMemorySegmentOnlyVector(Blackhole bh, IndexInput in, ES91OSQVectorsScorer scorer) throws IOException {
193+
private void scoreFromMemorySegmentOnlyVector(Blackhole bh, IndexInput in, ESNextOSQVectorsScorer scorer) throws IOException {
160194
for (int j = 0; j < numQueries; j++) {
161195
in.seek(0);
162196
for (int i = 0; i < numVectors; i++) {
@@ -203,7 +237,7 @@ public void scoreFromMemorySegmentOnlyVectorBulkNiofsVect(Blackhole bh) throws I
203237
scoreFromMemorySegmentOnlyVectorBulk(bh, inNiofs, scorerNfios);
204238
}
205239

206-
private void scoreFromMemorySegmentOnlyVectorBulk(Blackhole bh, IndexInput in, ES91OSQVectorsScorer scorer) throws IOException {
240+
private void scoreFromMemorySegmentOnlyVectorBulk(Blackhole bh, IndexInput in, ESNextOSQVectorsScorer scorer) throws IOException {
207241
for (int j = 0; j < numQueries; j++) {
208242
in.seek(0);
209243
for (int i = 0; i < numVectors; i += 16) {
@@ -252,7 +286,7 @@ public void scoreFromMemorySegmentAllBulkNiofsVect(Blackhole bh) throws IOExcept
252286
scoreFromMemorySegmentAllBulk(bh, inNiofs, scorerNfios);
253287
}
254288

255-
private void scoreFromMemorySegmentAllBulk(Blackhole bh, IndexInput in, ES91OSQVectorsScorer scorer) throws IOException {
289+
private void scoreFromMemorySegmentAllBulk(Blackhole bh, IndexInput in, ESNextOSQVectorsScorer scorer) throws IOException {
256290
for (int j = 0; j < numQueries; j++) {
257291
in.seek(0);
258292
for (int i = 0; i < numVectors; i += 16) {

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/LicensingPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ public void apply(Project project) {
4444
Provider<String> agplLicenseURL = licenseCommitProvider.map(
4545
licenseCommit -> ELASTIC_LICENSE_URL_PREFIX + licenseCommit + AGPL_ELASTIC_LICENSE_URL_POSTFIX
4646
);
47-
// But stick the Elastic license url in project.ext so we can get it if we need to switch to it
47+
// Stick the license urls in project.ext so we can get them if we need to switch to them
4848
project.getExtensions().getExtraProperties().set("elasticLicenseUrl", elasticLicenseURL);
49+
project.getExtensions().getExtraProperties().set("agplLicenseUrl", agplLicenseURL);
4950

5051
MapProperty<String, Provider<String>> licensesProperty = project.getObjects()
5152
.mapProperty(String.class, (Class<Provider<String>>) (Class<?>) Provider.class)

build-tools-internal/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=b84e04fa845fecba48551f425957641074fcc00a88a84d2aae5808743b35fc85
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
3+
distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import org.gradle.api.Plugin;
1313
import org.gradle.api.Project;
14+
import org.gradle.api.plugins.JavaPlugin;
1415
import org.gradle.api.provider.ProviderFactory;
1516

1617
import javax.inject.Inject;
@@ -25,6 +26,7 @@ public InternalTestArtifactBasePlugin(ProviderFactory providerFactory) {
2526

2627
@Override
2728
public void apply(Project project) {
29+
project.getPlugins().apply(JavaPlugin.class);
2830
project.getPlugins().apply(ElasticsearchJavaBasePlugin.class);
2931
project.getExtensions().create("testArtifacts", InternalTestArtifactExtension.class, project, providerFactory);
3032
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ public void apply(final Project project) {
5353

5454
// only setup tests to build
5555
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
56-
final SourceSet testSourceSet = sourceSets.create("test");
56+
final SourceSet testSourceSet = sourceSets.maybeCreate("test");
5757

5858
project.getTasks().withType(Test.class).configureEach(test -> {
5959
test.setTestClassesDirs(testSourceSet.getOutput().getClassesDirs());
6060
test.setClasspath(testSourceSet.getRuntimeClasspath());
6161
});
6262

6363
// create a compileOnly configuration as others might expect it
64-
project.getConfigurations().create("compileOnly");
64+
project.getConfigurations().maybeCreate("compileOnly");
6565
RestTestUtil.setupJavaRestTestDependenciesDefaults(project, testSourceSet);
6666

6767
EclipseModel eclipse = project.getExtensions().getByType(EclipseModel.class);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9.1.0
1+
9.2.0

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ tasks.named('zipAggregation').configure {
7777
destinationDirectory.set(layout.buildDirectory.dir("distributions"));
7878

7979
dependsOn gradle.includedBuild('build-tools').task(':zipElasticPublication')
80-
from(zipTree(gradle.includedBuild('build-tools').task(':zipElasticPublication').resolveTask().archiveFile.get()))
80+
from(zipTree("build-tools/build/nmcp/zip/publicationElastic.zip"))
8181
}
8282

8383
/**

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:dea9b73186c5565a5bfa820a68f63ff497fdc9f06a0afc777159d819c5f01dc4 AS builder
28+
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest@sha256:a02c67d96cd6ec1b50a055f1f5515e0987b643d001d436088cefc02e5b786bf9 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:dea9b73186c5565a5bfa820a68f63ff497fdc9f06a0afc777159d819c5f01dc4
107+
FROM docker.elastic.co/wolfi/chainguard-base-fips:latest@sha256:a02c67d96cd6ec1b50a055f1f5515e0987b643d001d436088cefc02e5b786bf9
108108

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

0 commit comments

Comments
 (0)