Skip to content

Commit 521f4d8

Browse files
committed
Merge branch 'main' into lucene_snapshot
2 parents 9b12969 + cae06b8 commit 521f4d8

File tree

1,175 files changed

+30449
-6757
lines changed

Some content is hidden

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

1,175 files changed

+30449
-6757
lines changed

.buildkite/scripts/third-party-test-credentials.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -euo pipefail
77
# The second/lowercase export is what the tests expect/require
88

99
if [[ "${USE_3RD_PARTY_AZURE_CREDENTIALS:-}" == "true" ]]; then
10+
# These credentials expire periodically and must be manually renewed - the process is in the onboarding/process docs.
1011
json=$(vault read -format=json secret/ci/elastic-elasticsearch/migrated/azure_thirdparty_test_creds)
1112

1213
AZURE_STORAGE_ACCOUNT_SECRET=$(echo "$json" | jq -r .data.account_id)
@@ -19,6 +20,7 @@ if [[ "${USE_3RD_PARTY_AZURE_CREDENTIALS:-}" == "true" ]]; then
1920
fi
2021

2122
if [[ "${USE_3RD_PARTY_AZURE_SAS_CREDENTIALS:-}" == "true" ]]; then
23+
# These credentials expire periodically and must be manually renewed - the process is in the onboarding/process docs.
2224
json=$(vault read -format=json secret/ci/elastic-elasticsearch/migrated/azure_thirdparty_sas_test_creds)
2325

2426
AZURE_STORAGE_ACCOUNT_SECRET=$(echo "$json" | jq -r .data.account_id)

README.asciidoc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ From the `elastic-start-local` folder, check the connection to Elasticsearch usi
9797
source .env
9898
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
9999
----
100+
101+
To use the password for the `elastic` user, set and export the `ES_LOCAL_PASSWORD` environment variable. For example:
102+
103+
[source,sh]
104+
----
105+
source .env
106+
export ES_LOCAL_PASSWORD
107+
----
108+
100109
// NOTCONSOLE
101110

102111
=== Send requests to Elasticsearch
@@ -112,22 +121,23 @@ Here's an example curl command to create a new Elasticsearch index, using basic
112121

113122
[source,sh]
114123
----
115-
curl -u elastic:$ELASTIC_PASSWORD \
124+
curl -u elastic:$ES_LOCAL_PASSWORD \
116125
-X PUT \
117126
http://localhost:9200/my-new-index \
118127
-H 'Content-Type: application/json'
119128
----
129+
120130
// NOTCONSOLE
121131

122132
==== Using a language client
123133

124-
To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password you set in the environment variable.
134+
To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password stored in the `ES_LOCAL_PASSWORD` environment variable.
125135

126136
You'll use the following connection details:
127137

128138
* **Elasticsearch endpoint**: `http://localhost:9200`
129139
* **Username**: `elastic`
130-
* **Password**: `$ELASTIC_PASSWORD` (Value you set in the environment variable)
140+
* **Password**: `$ES_LOCAL_PASSWORD` (Value you set in the environment variable)
131141

132142
For example, to connect with the Python `elasticsearch` client:
133143

@@ -137,7 +147,7 @@ import os
137147
from elasticsearch import Elasticsearch
138148
139149
username = 'elastic'
140-
password = os.getenv('ELASTIC_PASSWORD') # Value you set in the environment variable
150+
password = os.getenv('ES_LOCAL_PASSWORD') # Value you set in the environment variable
141151
142152
client = Elasticsearch(
143153
"http://localhost:9200",

TESTING.asciidoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,8 @@ run it using Gradle:
4646
==== Launching and debugging from an IDE
4747

4848
If you want to run and debug Elasticsearch from your IDE, the `./gradlew run` task
49-
supports a remote debugging option. Run the following from your terminal:
50-
51-
---------------------------------------------------------------------------
52-
./gradlew run --debug-jvm
53-
---------------------------------------------------------------------------
54-
55-
Next start the "Debug Elasticsearch" run configuration in IntelliJ. This will enable the IDE to connect to the process and allow debug functionality.
56-
49+
supports a remote debugging option. Start the "Debug Elasticsearch" run configuration in IntelliJ. This will enable the
50+
IDE to connect to the process and allow debug functionality.
5751

5852
As such the IDE needs to be instructed to listen for connections on the debug port.
5953
Since we might run multiple JVMs as part of configuring and starting the cluster it's
@@ -64,6 +58,12 @@ NOTE: If you have imported the project into IntelliJ according to the instructio
6458
link:/CONTRIBUTING.md#importing-the-project-into-intellij-idea[CONTRIBUTING.md] then a debug run configuration
6559
named "Debug Elasticsearch" will be created for you and configured appropriately.
6660

61+
Next run the following from your terminal:
62+
63+
---------------------------------------------------------------------------
64+
./gradlew run --debug-jvm
65+
---------------------------------------------------------------------------
66+
6767
===== Debugging the CLI launcher
6868

6969
The gradle task does not start the Elasticsearch server process directly; like in the Elasticsearch distribution,

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
import org.elasticsearch.compute.data.Block;
2222
import org.elasticsearch.compute.data.BlockFactory;
2323
import org.elasticsearch.compute.data.BytesRefBlock;
24+
import org.elasticsearch.compute.data.BytesRefVector;
2425
import org.elasticsearch.compute.data.ElementType;
2526
import org.elasticsearch.compute.data.IntBlock;
27+
import org.elasticsearch.compute.data.IntVector;
2628
import org.elasticsearch.compute.data.LongBlock;
2729
import org.elasticsearch.compute.data.LongVector;
30+
import org.elasticsearch.compute.data.OrdinalBytesRefVector;
2831
import org.elasticsearch.compute.data.Page;
2932
import org.elasticsearch.compute.operator.AggregationOperator;
3033
import org.elasticsearch.compute.operator.DriverContext;
@@ -282,11 +285,18 @@ private static Block dataBlock(int groups, String dataType) {
282285
int blockLength = blockLength(groups);
283286
return switch (dataType) {
284287
case BYTES_REF -> {
285-
try (BytesRefBlock.Builder builder = blockFactory.newBytesRefBlockBuilder(blockLength)) {
288+
try (
289+
BytesRefVector.Builder dict = blockFactory.newBytesRefVectorBuilder(blockLength);
290+
IntVector.Builder ords = blockFactory.newIntVectorBuilder(blockLength)
291+
) {
292+
final int dictLength = Math.min(blockLength, KEYWORDS.length);
293+
for (int i = 0; i < dictLength; i++) {
294+
dict.appendBytesRef(KEYWORDS[i]);
295+
}
286296
for (int i = 0; i < blockLength; i++) {
287-
builder.appendBytesRef(KEYWORDS[i % KEYWORDS.length]);
297+
ords.appendInt(i % dictLength);
288298
}
289-
yield builder.build();
299+
yield new OrdinalBytesRefVector(ords.build(), dict.build()).asBlock();
290300
}
291301
}
292302
case INT -> {

benchmarks/src/main/java/org/elasticsearch/benchmark/script/ScriptScoreBenchmark.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
import org.elasticsearch.index.fielddata.IndexFieldDataCache;
3131
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
3232
import org.elasticsearch.index.mapper.MappedFieldType;
33+
import org.elasticsearch.index.mapper.MappingLookup;
3334
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberFieldType;
3435
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType;
36+
import org.elasticsearch.index.mapper.SourceFieldMetrics;
3537
import org.elasticsearch.indices.breaker.CircuitBreakerService;
3638
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
3739
import org.elasticsearch.plugins.PluginsLoader;
@@ -90,7 +92,7 @@ public class ScriptScoreBenchmark {
9092
private final SearchLookup lookup = new SearchLookup(
9193
fieldTypes::get,
9294
(mft, lookup, fdo) -> mft.fielddataBuilder(FieldDataContext.noRuntimeFields("benchmark")).build(fieldDataCache, breakerService),
93-
SourceProvider.fromStoredFields()
95+
SourceProvider.fromLookup(MappingLookup.EMPTY, null, SourceFieldMetrics.NOOP)
9496
);
9597

9698
@Param({ "expression", "metal", "painless_cast", "painless_def" })

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.apache.lucene.util.VectorUtil;
1818
import org.apache.lucene.util.quantization.OptimizedScalarQuantizer;
1919
import org.elasticsearch.common.logging.LogConfigurator;
20-
import org.elasticsearch.simdvec.internal.vectorization.ES91OSQVectorsScorer;
20+
import org.elasticsearch.simdvec.ES91OSQVectorsScorer;
2121
import org.elasticsearch.simdvec.internal.vectorization.ESVectorizationProvider;
2222
import org.openjdk.jmh.annotations.Benchmark;
2323
import org.openjdk.jmh.annotations.BenchmarkMode;

build-conventions/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
plugins {
11-
id "com.gradle.develocity" version "3.19.2"
11+
id "com.gradle.develocity" version "4.0.1"
1212
}
1313

1414
rootProject.name = 'build-conventions'

build-tools-internal/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pluginManagement {
99
}
1010

1111
plugins {
12-
id "com.gradle.develocity" version "3.19.2"
12+
id "com.gradle.develocity" version "4.0.1"
1313
}
1414

1515
dependencyResolutionManagement {

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,27 @@
1414
*/
1515
public enum DockerBase {
1616
// "latest" here is intentional, since the image name specifies "9"
17-
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "Dockerfile.default"),
17+
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "dockerfiles/default/Dockerfile"),
1818

1919
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
2020
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum", "Dockerfile"),
2121

2222
// Chainguard based wolfi image with latest jdk
23-
// This is usually updated via renovatebot
24-
// spotless:off
2523
WOLFI(
26-
"docker.elastic.co/wolfi/chainguard-base:latest@sha256:29150cd940cc7f69407d978d5a19c86f4d9e67cf44e4d6ded787a497e8f27c9a",
24+
null,
2725
"-wolfi",
2826
"apk",
29-
"Dockerfile"
27+
"dockerfiles/wolfi/Dockerfile"
3028
),
31-
// spotless:on
3229
// Based on WOLFI above, with more extras. We don't set a base image because
3330
// we programmatically extend from the wolfi image.
3431
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.ess"),
3532

3633
CLOUD_ESS_FIPS(
37-
"docker.elastic.co/wolfi/chainguard-base-fips:sha256-ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7@sha256:ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7",
34+
null,
3835
"-cloud-ess-fips",
3936
"apk",
40-
"Dockerfile.ess-fips"
37+
"dockerfiles/cloud_ess_fips/Dockerfile"
4138
);
4239

4340
private final String image;

build-tools/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ gradlePlugin {
5151
id = 'elasticsearch.stable-esplugin'
5252
implementationClass = 'org.elasticsearch.gradle.plugin.StablePluginBuildPlugin'
5353
}
54+
testBuildInfo {
55+
id = 'elasticsearch.test-build-info'
56+
implementationClass = 'org.elasticsearch.gradle.test.TestBuildInfoPlugin'
57+
}
5458
javaRestTest {
5559
id = 'elasticsearch.java-rest-test'
5660
implementationClass = 'org.elasticsearch.gradle.test.JavaRestTestPlugin'

build-tools/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pluginManagement {
1010
includeBuild "../build-conventions"
1111
}
1212
plugins {
13-
id "com.gradle.develocity" version "3.19.2"
13+
id "com.gradle.develocity" version "4.0.1"
1414
}
1515
include 'reaper'
1616

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package org.elasticsearch.gradle.test
2+
3+
import com.fasterxml.jackson.databind.ObjectMapper
4+
5+
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
6+
import org.gradle.testkit.runner.TaskOutcome
7+
8+
class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
9+
def "works"() {
10+
given:
11+
file("src/main/java/com/example/Example.java") << """
12+
package com.example;
13+
14+
public class Example {
15+
}
16+
"""
17+
18+
file("src/main/java/module-info.java") << """
19+
module com.example {
20+
exports com.example;
21+
}
22+
"""
23+
24+
buildFile << """
25+
import org.elasticsearch.gradle.plugin.GenerateTestBuildInfoTask;
26+
27+
plugins {
28+
id 'java'
29+
id 'elasticsearch.test-build-info'
30+
}
31+
32+
repositories {
33+
mavenCentral()
34+
}
35+
36+
tasks.withType(GenerateTestBuildInfoTask.class) {
37+
componentName = 'example-component'
38+
outputFile = new File('build/generated-build-info/plugin-test-build-info.json')
39+
}
40+
"""
41+
42+
when:
43+
def result = gradleRunner('generateTestBuildInfo').build()
44+
def task = result.task(":generateTestBuildInfo")
45+
46+
47+
then:
48+
task.outcome == TaskOutcome.SUCCESS
49+
50+
def output = file("build/generated-build-info/plugin-test-build-info.json")
51+
output.exists() == true
52+
53+
def location = Map.of(
54+
"module", "com.example",
55+
"representative_class", "com/example/Example.class"
56+
)
57+
def expectedOutput = Map.of(
58+
"component", "example-component",
59+
"locations", List.of(location)
60+
)
61+
new ObjectMapper().readValue(output, Map.class) == expectedOutput
62+
}
63+
}

build-tools/src/main/java/org/elasticsearch/gradle/plugin/BasePluginBuildPlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ private TaskProvider<Zip> createBundleTasks(final Project project, PluginPropert
121121
task.getIsLicensed().set(providerFactory.provider(extension::isLicensed));
122122

123123
var mainSourceSet = project.getExtensions().getByType(SourceSetContainer.class).getByName(SourceSet.MAIN_SOURCE_SET_NAME);
124-
FileCollection moduleInfoFile = mainSourceSet.getOutput().getAsFileTree().matching(p -> p.include("module-info.class"));
124+
FileCollection moduleInfoFile = mainSourceSet.getOutput()
125+
.getClassesDirs()
126+
.getAsFileTree()
127+
.matching(p -> p.include("module-info.class"));
125128
task.getModuleInfoFile().setFrom(moduleInfoFile);
126129

127130
});

0 commit comments

Comments
 (0)