Skip to content

Commit 6cabe33

Browse files
committed
Merge branch 'main' into add-bwcLucene87Codec
2 parents f17527f + 418cbbf commit 6cabe33

File tree

184 files changed

+1881
-1556
lines changed

Some content is hidden

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

184 files changed

+1881
-1556
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ indent_size = 4
209209
max_line_length = 140
210210
ij_java_class_count_to_use_import_on_demand = 999
211211
ij_java_names_count_to_use_import_on_demand = 999
212-
ij_java_imports_layout = *,|,com.**,|,org.**,|,java.**,javax.**,|,$*
212+
ij_java_imports_layout = *,|,com.**,|,org.**,|,java.**,|,javax.**,|,$*
213213

214214
[*.json]
215215
indent_size = 2

build-tools-internal/src/main/groovy/elasticsearch.ide.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,18 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
142142
description = 'Enables preview features on native library module'
143143
dependsOn tasks.named("enableExternalConfiguration")
144144

145-
doLast {
146-
['main', 'test'].each { sourceSet ->
147-
modifyXml(".idea/modules/libs/native/elasticsearch.libs.native.${sourceSet}.iml") { xml ->
148-
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = 'JDK_21_PREVIEW'
145+
ext {
146+
enablePreview = { moduleFile, languageLevel ->
147+
modifyXml(moduleFile) { xml ->
148+
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = languageLevel
149149
}
150150
}
151151
}
152+
153+
doLast {
154+
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.main.iml', 'JDK_21_PREVIEW')
155+
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.test.iml', 'JDK_21_PREVIEW')
156+
}
152157
}
153158

154159
tasks.register('buildDependencyArtifacts') {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public enum DockerBase {
2222
// Chainguard based wolfi image with latest jdk
2323
// This is usually updated via renovatebot
2424
// spotless:off
25-
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:55b297da5151d2a2997e8ab9729fe1304e4869389d7090ab7031cc29530f69f8",
25+
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:32f06b169bb4b0f257fbb10e8c8379f06d3ee1355c89b3327cb623781a29590e",
2626
"-wolfi",
2727
"apk"
2828
),

build-tools-internal/src/main/resources/forbidden/es-server-signatures.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,3 @@ org.elasticsearch.cluster.SnapshotDeletionsInProgress$Entry#<init>(java.lang.Str
167167
@defaultMessage Use a Thread constructor with a name, anonymous threads are more difficult to debug
168168
java.lang.Thread#<init>(java.lang.Runnable)
169169
java.lang.Thread#<init>(java.lang.ThreadGroup, java.lang.Runnable)
170-
171-
org.elasticsearch.common.bytes.BytesReference#copyBytes(org.elasticsearch.common.bytes.BytesReference) @ This method is a subject for removal. Copying bytes is prone to performance regressions and unnecessary allocations.

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class ElasticsearchNode implements TestClusterConfiguration {
9898
private static final int ES_DESTROY_TIMEOUT = 20;
9999
private static final TimeUnit ES_DESTROY_TIMEOUT_UNIT = TimeUnit.SECONDS;
100100

101-
private static final int NODE_UP_TIMEOUT = 2;
101+
private static final int NODE_UP_TIMEOUT = 3;
102102
private static final TimeUnit NODE_UP_TIMEOUT_UNIT = TimeUnit.MINUTES;
103103
private static final int ADDITIONAL_CONFIG_TIMEOUT = 15;
104104
private static final TimeUnit ADDITIONAL_CONFIG_TIMEOUT_UNIT = TimeUnit.SECONDS;

docs/changelog/116739.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 116739
2+
summary: Change default Docker image to be based on UBI minimal instead of Ubuntu
3+
area: Infra/Core
4+
type: enhancement
5+
issues: []

docs/changelog/117235.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117235
2+
summary: "Deprecate `ChunkingOptions` parameter"
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/117303.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117303
2+
summary: Remove HTTP content copies
3+
area: Network
4+
type: enhancement
5+
issues: []

docs/changelog/117503.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 117503
2+
summary: Fix COUNT filter pushdown
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 115522

docs/changelog/117551.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117551
2+
summary: Fix stats by constant expresson with alias
3+
area: ES|QL
4+
type: bug
5+
issues: []

docs/changelog/117595.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117595
2+
summary: Fix for Deberta tokenizer when input sequence exceeds 512 tokens
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/reference/connector/docs/connectors-content-syncs.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ However, a fast, accessible third-party data source that stores huge amounts of
5252

5353
[NOTE]
5454
====
55-
Incremental syncs for the SharePoint Online connector use specific logic.
55+
Incremental syncs for <<es-connectors-sharepoint-online,SharePoint Online>> and <<es-connectors-google-drive,Google Drive>> connectors use specific logic.
5656
All other connectors use the same shared connector framework logic for incremental syncs.
5757
====
5858

docs/reference/data-streams/tsds.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,5 @@ include::tsds-index-settings.asciidoc[]
339339
include::downsampling.asciidoc[]
340340
include::downsampling-ilm.asciidoc[]
341341
include::downsampling-manual.asciidoc[]
342+
include::downsampling-dsl.asciidoc[]
342343
include::tsds-reindex.asciidoc[]

docs/reference/inference/service-elser.asciidoc

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,39 @@ If `adaptive_allocations` is enabled, do not set this value, because it's automa
102102
Sets the number of threads used by each model allocation during inference. This generally increases the speed per inference request. The inference process is a compute-bound process; `threads_per_allocations` must not exceed the number of available allocated processors per node.
103103
Must be a power of 2. Max allowed value is 32.
104104

105+
[discrete]
106+
[[inference-example-elser-adaptive-allocation]]
107+
==== ELSER service example with adaptive allocations
108+
109+
When adaptive allocations are enabled, the number of allocations of the model is set automatically based on the current load.
110+
111+
NOTE: For more information on how to optimize your ELSER endpoints, refer to {ml-docs}/ml-nlp-elser.html#elser-recommendations[the ELSER recommendations] section in the model documentation.
112+
To learn more about model autoscaling, refer to the {ml-docs}/ml-nlp-auto-scale.html[trained model autoscaling] page.
113+
114+
The following example shows how to create an {infer} endpoint called `my-elser-model` to perform a `sparse_embedding` task type and configure adaptive allocations.
115+
116+
The request below will automatically download the ELSER model if it isn't already downloaded and then deploy the model.
117+
118+
[source,console]
119+
------------------------------------------------------------
120+
PUT _inference/sparse_embedding/my-elser-model
121+
{
122+
"service": "elser",
123+
"service_settings": {
124+
"adaptive_allocations": {
125+
"enabled": true,
126+
"min_number_of_allocations": 3,
127+
"max_number_of_allocations": 10
128+
},
129+
"num_threads": 1
130+
}
131+
}
132+
------------------------------------------------------------
133+
// TEST[skip:TBD]
105134

106135
[discrete]
107136
[[inference-example-elser]]
108-
==== ELSER service example
137+
==== ELSER service example without adaptive allocations
109138

110139
The following example shows how to create an {infer} endpoint called `my-elser-model` to perform a `sparse_embedding` task type.
111140
Refer to the {ml-docs}/ml-nlp-elser.html[ELSER model documentation] for more info.
@@ -151,32 +180,4 @@ You might see a 502 bad gateway error in the response when using the {kib} Conso
151180
This error usually just reflects a timeout, while the model downloads in the background.
152181
You can check the download progress in the {ml-app} UI.
153182
If using the Python client, you can set the `timeout` parameter to a higher value.
154-
====
155-
156-
[discrete]
157-
[[inference-example-elser-adaptive-allocation]]
158-
==== Setting adaptive allocations for the ELSER service
159-
160-
NOTE: For more information on how to optimize your ELSER endpoints, refer to {ml-docs}/ml-nlp-elser.html#elser-recommendations[the ELSER recommendations] section in the model documentation.
161-
To learn more about model autoscaling, refer to the {ml-docs}/ml-nlp-auto-scale.html[trained model autoscaling] page.
162-
163-
The following example shows how to create an {infer} endpoint called `my-elser-model` to perform a `sparse_embedding` task type and configure adaptive allocations.
164-
165-
The request below will automatically download the ELSER model if it isn't already downloaded and then deploy the model.
166-
167-
[source,console]
168-
------------------------------------------------------------
169-
PUT _inference/sparse_embedding/my-elser-model
170-
{
171-
"service": "elser",
172-
"service_settings": {
173-
"adaptive_allocations": {
174-
"enabled": true,
175-
"min_number_of_allocations": 3,
176-
"max_number_of_allocations": 10
177-
},
178-
"num_threads": 1
179-
}
180-
}
181-
------------------------------------------------------------
182-
// TEST[skip:TBD]
183+
====

docs/reference/intro.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ You can deploy {es} in various ways.
8585
**Hosted options**
8686

8787
* {cloud}/ec-getting-started-trial.html[*Elastic Cloud Hosted*]: {es} is available as part of the hosted Elastic Stack offering, deployed in the cloud with your provider of choice. Sign up for a https://cloud.elastic.co/registration[14-day free trial].
88-
* {serverless-docs}/general/sign-up-trial[*Elastic Cloud Serverless* (technical preview)]: Create serverless projects for autoscaled and fully managed {es} deployments. Sign up for a https://cloud.elastic.co/serverless-registration[14-day free trial].
88+
* {serverless-docs}/general/sign-up-trial[*Elastic Cloud Serverless*]: Create serverless projects for autoscaled and fully managed {es} deployments. Sign up for a https://cloud.elastic.co/serverless-registration[14-day free trial].
8989

9090
**Advanced options**
9191

libs/entitlement/asm-provider/src/main/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImpl.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,18 @@ static MethodKey parseCheckerMethodSignature(String checkerMethodName, Type[] ch
9191
String.format(
9292
Locale.ROOT,
9393
"Checker method %s has incorrect name format. "
94-
+ "It should be either check$$methodName (instance) or check$package_ClassName$methodName (static)",
94+
+ "It should be either check$$methodName (instance), check$package_ClassName$methodName (static) or "
95+
+ "check$package_ClassName$ (ctor)",
9596
checkerMethodName
9697
)
9798
);
9899
}
99100

100-
// No "className" (check$$methodName) -> method is static, and we'll get the class from the actual typed argument
101+
// No "className" (check$$methodName) -> method is instance, and we'll get the class from the actual typed argument
101102
final boolean targetMethodIsStatic = classNameStartIndex + 1 != classNameEndIndex;
102-
final String targetMethodName = checkerMethodName.substring(classNameEndIndex + 1);
103+
// No "methodName" (check$package_ClassName$) -> method is ctor
104+
final boolean targetMethodIsCtor = classNameEndIndex + 1 == checkerMethodName.length();
105+
final String targetMethodName = targetMethodIsCtor ? "<init>" : checkerMethodName.substring(classNameEndIndex + 1);
103106

104107
final String targetClassName;
105108
final List<String> targetParameterTypes;

libs/entitlement/asm-provider/src/main/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
154154
var mv = super.visitMethod(access, name, descriptor, signature, exceptions);
155155
if (isAnnotationPresent == false) {
156156
boolean isStatic = (access & ACC_STATIC) != 0;
157+
boolean isCtor = "<init>".equals(name);
157158
var key = new MethodKey(className, name, Stream.of(Type.getArgumentTypes(descriptor)).map(Type::getInternalName).toList());
158159
var instrumentationMethod = instrumentationMethods.get(key);
159160
if (instrumentationMethod != null) {
160161
// LOGGER.debug("Will instrument method {}", key);
161-
return new EntitlementMethodVisitor(Opcodes.ASM9, mv, isStatic, descriptor, instrumentationMethod);
162+
return new EntitlementMethodVisitor(Opcodes.ASM9, mv, isStatic, isCtor, descriptor, instrumentationMethod);
162163
} else {
163164
// LOGGER.trace("Will not instrument method {}", key);
164165
}
@@ -187,6 +188,7 @@ private void addClassAnnotationIfNeeded() {
187188

188189
class EntitlementMethodVisitor extends MethodVisitor {
189190
private final boolean instrumentedMethodIsStatic;
191+
private final boolean instrumentedMethodIsCtor;
190192
private final String instrumentedMethodDescriptor;
191193
private final CheckerMethod instrumentationMethod;
192194
private boolean hasCallerSensitiveAnnotation = false;
@@ -195,11 +197,13 @@ class EntitlementMethodVisitor extends MethodVisitor {
195197
int api,
196198
MethodVisitor methodVisitor,
197199
boolean instrumentedMethodIsStatic,
200+
boolean instrumentedMethodIsCtor,
198201
String instrumentedMethodDescriptor,
199202
CheckerMethod instrumentationMethod
200203
) {
201204
super(api, methodVisitor);
202205
this.instrumentedMethodIsStatic = instrumentedMethodIsStatic;
206+
this.instrumentedMethodIsCtor = instrumentedMethodIsCtor;
203207
this.instrumentedMethodDescriptor = instrumentedMethodDescriptor;
204208
this.instrumentationMethod = instrumentationMethod;
205209
}
@@ -260,14 +264,15 @@ private void pushCallerClass() {
260264

261265
private void forwardIncomingArguments() {
262266
int localVarIndex = 0;
263-
if (instrumentedMethodIsStatic == false) {
267+
if (instrumentedMethodIsCtor) {
268+
localVarIndex++;
269+
} else if (instrumentedMethodIsStatic == false) {
264270
mv.visitVarInsn(Opcodes.ALOAD, localVarIndex++);
265271
}
266272
for (Type type : Type.getArgumentTypes(instrumentedMethodDescriptor)) {
267273
mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), localVarIndex);
268274
localVarIndex += type.getSize();
269275
}
270-
271276
}
272277

273278
private void invokeInstrumentationMethod() {

libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ interface TestCheckerOverloads {
4545
void check$org_example_TestTargetClass$staticMethodWithOverload(Class<?> clazz, int x, String y);
4646
}
4747

48+
interface TestCheckerCtors {
49+
void check$org_example_TestTargetClass$(Class<?> clazz);
50+
51+
void check$org_example_TestTargetClass$(Class<?> clazz, int x, String y);
52+
}
53+
4854
public void testInstrumentationTargetLookup() throws IOException, ClassNotFoundException {
4955
Map<MethodKey, CheckerMethod> methodsMap = instrumentationService.lookupMethodsToInstrument(TestChecker.class.getName());
5056

@@ -142,6 +148,38 @@ public void testInstrumentationTargetLookupWithOverloads() throws IOException, C
142148
);
143149
}
144150

151+
public void testInstrumentationTargetLookupWithCtors() throws IOException, ClassNotFoundException {
152+
Map<MethodKey, CheckerMethod> methodsMap = instrumentationService.lookupMethodsToInstrument(TestCheckerCtors.class.getName());
153+
154+
assertThat(methodsMap, aMapWithSize(2));
155+
assertThat(
156+
methodsMap,
157+
hasEntry(
158+
equalTo(new MethodKey("org/example/TestTargetClass", "<init>", List.of("I", "java/lang/String"))),
159+
equalTo(
160+
new CheckerMethod(
161+
"org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests$TestCheckerCtors",
162+
"check$org_example_TestTargetClass$",
163+
List.of("Ljava/lang/Class;", "I", "Ljava/lang/String;")
164+
)
165+
)
166+
)
167+
);
168+
assertThat(
169+
methodsMap,
170+
hasEntry(
171+
equalTo(new MethodKey("org/example/TestTargetClass", "<init>", List.of())),
172+
equalTo(
173+
new CheckerMethod(
174+
"org/elasticsearch/entitlement/instrumentation/impl/InstrumentationServiceImplTests$TestCheckerCtors",
175+
"check$org_example_TestTargetClass$",
176+
List.of("Ljava/lang/Class;")
177+
)
178+
)
179+
)
180+
);
181+
}
182+
145183
public void testParseCheckerMethodSignatureStaticMethod() {
146184
var methodKey = InstrumentationServiceImpl.parseCheckerMethodSignature(
147185
"check$org_example_TestClass$staticMethod",
@@ -169,6 +207,24 @@ public void testParseCheckerMethodSignatureStaticMethodInnerClass() {
169207
assertThat(methodKey, equalTo(new MethodKey("org/example/TestClass$InnerClass", "staticMethod", List.of())));
170208
}
171209

210+
public void testParseCheckerMethodSignatureCtor() {
211+
var methodKey = InstrumentationServiceImpl.parseCheckerMethodSignature(
212+
"check$org_example_TestClass$",
213+
new Type[] { Type.getType(Class.class) }
214+
);
215+
216+
assertThat(methodKey, equalTo(new MethodKey("org/example/TestClass", "<init>", List.of())));
217+
}
218+
219+
public void testParseCheckerMethodSignatureCtorWithArgs() {
220+
var methodKey = InstrumentationServiceImpl.parseCheckerMethodSignature(
221+
"check$org_example_TestClass$",
222+
new Type[] { Type.getType(Class.class), Type.getType("I"), Type.getType(String.class) }
223+
);
224+
225+
assertThat(methodKey, equalTo(new MethodKey("org/example/TestClass", "<init>", List.of("I", "java/lang/String"))));
226+
}
227+
172228
public void testParseCheckerMethodSignatureIncorrectName() {
173229
var exception = assertThrows(
174230
IllegalArgumentException.class,

0 commit comments

Comments
 (0)