Skip to content

Commit a8042af

Browse files
Merge branch 'main' into feature/allocation-explain-query-string-parameter-127028
2 parents 77080cb + d487eb5 commit a8042af

File tree

131 files changed

+2753
-1459
lines changed

Some content is hidden

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

131 files changed

+2753
-1459
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,13 @@ You can import the Elasticsearch project into IntelliJ IDEA via:
168168

169169
#### Checkstyle
170170

171-
If you have the [Checkstyle] plugin installed, you can configure IntelliJ to
172-
check the Elasticsearch code. However, the Checkstyle configuration file does
173-
not work by default with the IntelliJ plugin, so instead an IDE-specific config
174-
file is generated automatically after IntelliJ finishes syncing. You can
175-
manually generate the file with `./gradlew configureIdeCheckstyle` in case
176-
it is removed due to a `./gradlew clean` or other action.
177-
178-
IntelliJ should be automatically configured to use the generated rules after
179-
import via the `.idea/checkstyle-idea.xml` configuration file. No further
180-
action is required.
171+
IntelliJ should automatically configure checkstyle. It does so by running
172+
`configureIdeCheckstyle` on import. That makes `.idea/checkstyle-idea.xml`
173+
configuration file. IntelliJ points checkstyle at that.
174+
175+
Things like `./gradlew clean` or `git clean -xdf` can nuke the file. You can
176+
regenerate it by running `./gradlew -Didea.active=true configureIdeCheckstyle`,
177+
but generally shouldn't have to.
181178

182179
#### Formatting
183180

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/PublishPluginFuncTest.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99

1010
package org.elasticsearch.gradle.internal
1111

12+
import spock.lang.IgnoreIf
13+
1214
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
1315
import org.gradle.testkit.runner.TaskOutcome
1416
import org.xmlunit.builder.DiffBuilder
1517
import org.xmlunit.builder.Input
1618

19+
// Ignoring this test on windows due to what appears to be a bug in the gradle testkit runner.
20+
// https://github.com/elastic/elasticsearch/issues/129100
21+
@IgnoreIf({ os.isWindows() })
1722
class PublishPluginFuncTest extends AbstractGradleFuncTest {
1823

1924
def setup() {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import org.elasticsearch.gradle.Version
11+
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
12+
13+
tasks.register("bcUpgradeTest", StandaloneRestIntegTestTask) {
14+
// We use a phony version here as the real version is provided via `tests.bwc.main.version` system property
15+
usesBwcDistribution(Version.fromString("0.0.0"))
16+
systemProperty("tests.old_cluster_version", "0.0.0")
17+
onlyIf("tests.bwc.main.version system property exists") { System.getProperty("tests.bwc.main.version") != null }
18+
}

docs/changelog/129223.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129223
2+
summary: Fix text similarity reranker does not propagate min score correctly
3+
area: Search
4+
type: bug
5+
issues: []

docs/changelog/129326.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 129326
2+
summary: Check positions on `MultiPhraseQueries` as well as phrase queries
3+
area: Search
4+
type: bug
5+
issues:
6+
- 123871

docs/changelog/129359.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129359
2+
summary: Add min score linear retriever
3+
area: Search
4+
type: enhancement
5+
issues: []

docs/changelog/129367.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 129367
2+
summary: Run `TransportGetStatusAction` on local node
3+
area: ILM+SLM
4+
type: enhancement
5+
issues: []

docs/changelog/129391.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 129391
2+
summary: Ensure that anomaly detection job state update retries if master node is
3+
temoporarily unavailable
4+
area: Machine Learning
5+
type: bug
6+
issues:
7+
- 126148

docs/reference/enrich-processor/normalize-for-stream.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ If the document is not OpenTelemetry-compliant, the processor normalizes it as f
4040
| `trace.id` | `trace_id` |
4141
| `message` | `body.text` |
4242
| `log.level` | `severity_text` |
43+
4344
The processor first looks for the nested form of the ECS field and if such does not exist, it looks for a top-level field with the dotted field name.
4445
* Other specific ECS fields that describe resources and have corresponding counterparts in the OpenTelemetry Semantic Conventions are moved to the `resource.attribtues` map. Fields that are considered resource attributes are such that conform to the following conditions:
4546
* They are ECS fields that have corresponding counterparts (either with

libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParser.java

Lines changed: 67 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@
2121

2222
import java.io.IOException;
2323
import java.io.InputStream;
24+
import java.util.ArrayList;
25+
import java.util.List;
2426

2527
public class ESUTF8StreamJsonParser extends UTF8StreamJsonParser {
2628
protected int stringEnd = -1;
29+
protected int stringLength;
30+
31+
private final List<Integer> backslashes = new ArrayList<>();
2732

2833
public ESUTF8StreamJsonParser(
2934
IOContext ctxt,
@@ -43,15 +48,12 @@ public ESUTF8StreamJsonParser(
4348
/**
4449
* Method that will try to get underlying UTF-8 encoded bytes of the current string token.
4550
* This is only a best-effort attempt; if there is some reason the bytes cannot be retrieved, this method will return null.
46-
* Currently, this is only implemented for ascii-only strings that do not contain escaped characters.
4751
*/
4852
public Text getValueAsText() throws IOException {
4953
if (_currToken == JsonToken.VALUE_STRING && _tokenIncomplete) {
5054
if (stringEnd > 0) {
5155
final int len = stringEnd - 1 - _inputPtr;
52-
// For now, we can use `len` for `stringLength` because we only support ascii-encoded unescaped strings,
53-
// which means each character uses exactly 1 byte.
54-
return new Text(new XContentString.UTF8Bytes(_inputBuffer, _inputPtr, len), len);
56+
return new Text(new XContentString.UTF8Bytes(_inputBuffer, _inputPtr, len), stringLength);
5557
}
5658
return _finishAndReturnText();
5759
}
@@ -69,21 +71,71 @@ protected Text _finishAndReturnText() throws IOException {
6971
final int[] codes = INPUT_CODES_UTF8;
7072
final int max = _inputEnd;
7173
final byte[] inputBuffer = _inputBuffer;
72-
while (ptr < max) {
74+
stringLength = 0;
75+
backslashes.clear();
76+
77+
loop: while (true) {
78+
if (ptr >= max) {
79+
return null;
80+
}
7381
int c = inputBuffer[ptr] & 0xFF;
74-
if (codes[c] != 0) {
75-
if (c == INT_QUOTE) {
76-
stringEnd = ptr + 1;
77-
final int len = ptr - startPtr;
78-
// For now, we can use `len` for `stringLength` because we only support ascii-encoded unescaped strings,
79-
// which means each character uses exactly 1 byte.
80-
return new Text(new XContentString.UTF8Bytes(inputBuffer, startPtr, len), len);
82+
switch (codes[c]) {
83+
case 0 -> {
84+
++ptr;
85+
++stringLength;
86+
}
87+
case 1 -> {
88+
if (c == INT_QUOTE) {
89+
// End of the string
90+
break loop;
91+
}
92+
assert c == INT_BACKSLASH;
93+
backslashes.add(ptr);
94+
++ptr;
95+
if (ptr >= max) {
96+
// Backslash at end of file
97+
return null;
98+
}
99+
c = inputBuffer[ptr] & 0xFF;
100+
if (c == '"' || c == '/' || c == '\\') {
101+
ptr += 1;
102+
stringLength += 1;
103+
} else {
104+
// Any other escaped sequence requires replacing the sequence with
105+
// a new character, which we don't support in the optimized path
106+
return null;
107+
}
108+
}
109+
case 2, 3, 4 -> {
110+
int bytesToSkip = codes[c];
111+
if (ptr + bytesToSkip > max) {
112+
return null;
113+
}
114+
ptr += bytesToSkip;
115+
++stringLength;
116+
}
117+
default -> {
118+
return null;
81119
}
82-
return null;
83120
}
84-
++ptr;
85121
}
86-
return null;
122+
123+
stringEnd = ptr + 1;
124+
if (backslashes.isEmpty()) {
125+
return new Text(new XContentString.UTF8Bytes(inputBuffer, startPtr, ptr - startPtr), stringLength);
126+
} else {
127+
byte[] buff = new byte[ptr - startPtr - backslashes.size()];
128+
int copyPtr = startPtr;
129+
int destPtr = 0;
130+
for (Integer backslash : backslashes) {
131+
int length = backslash - copyPtr;
132+
System.arraycopy(inputBuffer, copyPtr, buff, destPtr, length);
133+
destPtr += length;
134+
copyPtr = backslash + 1;
135+
}
136+
System.arraycopy(inputBuffer, copyPtr, buff, destPtr, ptr - copyPtr);
137+
return new Text(new XContentString.UTF8Bytes(buff), stringLength);
138+
}
87139
}
88140

89141
@Override

0 commit comments

Comments
 (0)