Skip to content

Commit f77a617

Browse files
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents 55ade97 + 88996bc commit f77a617

File tree

278 files changed

+6289
-2262
lines changed

Some content is hidden

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

278 files changed

+6289
-2262
lines changed

docs/changelog/120302.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 120302
2+
summary: "ESQL: Enhanced `DATE_TRUNC` with arbitrary intervals"
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 120094

docs/changelog/121041.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121041
2+
summary: Support configurable chunking in `semantic_text` fields
3+
area: Relevance
4+
type: enhancement
5+
issues: []

docs/changelog/125060.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pr: 125060
2+
summary: Allow partial results by default in ES|QL
3+
area: ES|QL
4+
type: breaking
5+
issues: [122802]
6+
7+
breaking:
8+
title: Allow partial results by default in ES|QL
9+
area: ES|QL
10+
details: >-
11+
In earlier versions of {es}, ES|QL would fail the entire query if it encountered any error. ES|QL now returns partial results instead of failing when encountering errors.
12+
13+
impact: >-
14+
Callers should check the `is_partial` flag returned in the response to determine if the result is partial or complete. If returning partial results is not desired, this option can be overridden per request via an `allow_partial_results` parameter in the query URL or globally via the cluster setting `esql.query.allow_partial_results`.
15+
16+
notable: true

docs/changelog/125452.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125452
2+
summary: Add GCS telemetry with `ThreadLocal`
3+
area: Snapshot/Restore
4+
type: enhancement
5+
issues: []

docs/changelog/125732.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125732
2+
summary: Log stack traces on data nodes before they are cleared for transport
3+
area: Search
4+
type: bug
5+
issues: []

docs/changelog/125896.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125896
2+
summary: Support explicit Z/M attributes using WKT geometry
3+
area: Geo
4+
type: enhancement
5+
issues: [123111]

docs/changelog/126191.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126191
2+
summary: Fix NPE for missing Content Type header in OIDC Authenticator
3+
area: Authentication
4+
type: bug
5+
issues: []

docs/reference/elasticsearch/mapping-reference/semantic-text.md

+119-41
Large diffs are not rendered by default.

docs/reference/query-languages/esql/_snippets/functions/description/date_trunc.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/examples/bucket.md

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/definition/functions/date_trunc.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/date_trunc.md

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/release-notes/breaking-changes.md

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ To learn how to upgrade, check out <uprade docs>.
1414

1515
% ## Next version [elasticsearch-nextversion-breaking-changes]
1616

17+
## 9.1.0 [elasticsearch-910-breaking-changes]
18+
19+
ES|QL
20+
: * Allow partial results by default in ES|QL [#125060](https://github.com/elastic/elasticsearch/pull/125060)
21+
1722
## 9.0.0 [elasticsearch-900-breaking-changes]
1823

1924
Allocation

libs/entitlement/README.md

+187-6
Large diffs are not rendered by default.

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyUtils.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ private static void validatePolicyScopes(String layerName, Policy policy, Set<St
141141
public static Policy parsePolicyIfExists(String pluginName, Path pluginRoot, boolean isExternalPlugin) throws IOException {
142142
Path policyFile = pluginRoot.resolve(POLICY_FILE_NAME);
143143
if (Files.exists(policyFile)) {
144-
return new PolicyParser(Files.newInputStream(policyFile, StandardOpenOption.READ), pluginName, isExternalPlugin).parsePolicy();
144+
try (var inputStream = Files.newInputStream(policyFile, StandardOpenOption.READ)) {
145+
return new PolicyParser(inputStream, pluginName, isExternalPlugin).parsePolicy();
146+
}
145147
}
146148
return new Policy(pluginName, List.of());
147149
}

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/entitlements/FilesEntitlement.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.elasticsearch.entitlement.runtime.policy.Platform;
1717
import org.elasticsearch.entitlement.runtime.policy.PolicyValidationException;
1818

19+
import java.nio.file.FileSystems;
1920
import java.nio.file.Path;
2021
import java.util.ArrayList;
2122
import java.util.HashMap;
@@ -31,6 +32,8 @@
3132
*/
3233
public record FilesEntitlement(List<FileData> filesData) implements Entitlement {
3334

35+
public static final String SEPARATOR = FileSystems.getDefault().getSeparator();
36+
3437
public static final FilesEntitlement EMPTY = new FilesEntitlement(List.of());
3538

3639
public enum Mode {
@@ -160,7 +163,7 @@ public FileData withPlatform(Platform platform) {
160163

161164
@Override
162165
public String description() {
163-
return Strings.format("[%s] <%s>/%s%s", mode, baseDir, relativePath, exclusive ? " (exclusive)" : "");
166+
return Strings.format("[%s] <%s>%s%s%s", mode, baseDir, SEPARATOR, relativePath, exclusive ? " (exclusive)" : "");
164167
}
165168
}
166169

@@ -192,7 +195,7 @@ public FileData withPlatform(Platform platform) {
192195

193196
@Override
194197
public String description() {
195-
return Strings.format("[%s] <%s>/<%s>%s", mode, baseDir, setting, exclusive ? " (exclusive)" : "");
198+
return Strings.format("[%s] <%s>%s<%s>%s", mode, baseDir, SEPARATOR, setting, exclusive ? " (exclusive)" : "");
196199
}
197200
}
198201

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/PolicyUtilsTests.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.List;
2828
import java.util.Set;
2929

30+
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.SEPARATOR;
3031
import static org.elasticsearch.test.LambdaMatchers.transformedMatch;
3132
import static org.hamcrest.Matchers.both;
3233
import static org.hamcrest.Matchers.containsInAnyOrder;
@@ -317,6 +318,7 @@ public void testFormatPolicyWithMultipleScopes() {
317318
/** Test that we can format some simple files entitlement properly */
318319
public void testFormatFilesEntitlement() {
319320
var pathAB = Path.of("/a/b");
321+
var pathCD = Path.of("c/d");
320322
var policy = new Policy(
321323
"test-plugin",
322324
List.of(
@@ -326,11 +328,7 @@ public void testFormatFilesEntitlement() {
326328
new FilesEntitlement(
327329
List.of(
328330
FilesEntitlement.FileData.ofPath(pathAB, FilesEntitlement.Mode.READ_WRITE),
329-
FilesEntitlement.FileData.ofRelativePath(
330-
Path.of("c/d"),
331-
FilesEntitlement.BaseDir.DATA,
332-
FilesEntitlement.Mode.READ
333-
)
331+
FilesEntitlement.FileData.ofRelativePath(pathCD, FilesEntitlement.BaseDir.DATA, FilesEntitlement.Mode.READ)
334332
)
335333
)
336334
)
@@ -353,7 +351,17 @@ public void testFormatFilesEntitlement() {
353351
)
354352
);
355353
Set<String> actual = PolicyUtils.getEntitlementsDescriptions(policy);
356-
assertThat(actual, containsInAnyOrder("files [READ_WRITE] " + pathAB, "files [READ] <DATA>/c/d", "files [READ] <DATA>/<setting>"));
354+
var pathABString = pathAB.toAbsolutePath().toString();
355+
var pathCDString = SEPARATOR + pathCD.toString();
356+
var pathSettingString = SEPARATOR + "<setting>";
357+
assertThat(
358+
actual,
359+
containsInAnyOrder(
360+
"files [READ_WRITE] " + pathABString,
361+
"files [READ] <DATA>" + pathCDString,
362+
"files [READ] <DATA>" + pathSettingString
363+
)
364+
);
357365
}
358366

359367
/** Test that we can format some simple files entitlement properly */

libs/geo/src/main/java/org/elasticsearch/geometry/utils/WellKnownText.java

+29-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public class WellKnownText {
4444
public static final String RPAREN = ")";
4545
public static final String COMMA = ",";
4646
public static final String NAN = "NaN";
47+
public static final String Z = "Z";
48+
public static final String M = "M";
4749
public static final int MAX_NESTED_DEPTH = 1000;
4850

4951
private static final String NUMBER = "<NUMBER>";
@@ -440,7 +442,8 @@ public static Geometry fromWKT(GeometryValidator validator, boolean coerce, Stri
440442
*/
441443
private static Geometry parseGeometry(StreamTokenizer stream, boolean coerce, int depth) throws IOException, ParseException {
442444
final String type = nextWord(stream).toLowerCase(Locale.ROOT);
443-
return switch (type) {
445+
final boolean isExplicitlySpecifiesZorM = isZOrMNext(stream);
446+
Geometry geometry = switch (type) {
444447
case "point" -> parsePoint(stream);
445448
case "multipoint" -> parseMultiPoint(stream);
446449
case "linestring" -> parseLine(stream);
@@ -453,6 +456,16 @@ private static Geometry parseGeometry(StreamTokenizer stream, boolean coerce, in
453456
parseCircle(stream);
454457
default -> throw new IllegalArgumentException("Unknown geometry type: " + type);
455458
};
459+
checkZorMAttribute(isExplicitlySpecifiesZorM, geometry.hasZ());
460+
return geometry;
461+
}
462+
463+
private static void checkZorMAttribute(boolean isExplicitlySpecifiesZorM, boolean hasZ) {
464+
if (isExplicitlySpecifiesZorM && hasZ == false) {
465+
throw new IllegalArgumentException(
466+
"When specifying 'Z' or 'M', coordinates must include three values. Only two coordinates were provided"
467+
);
468+
}
456469
}
457470

458471
private static GeometryCollection<Geometry> parseGeometryCollection(StreamTokenizer stream, boolean coerce, int depth)
@@ -710,6 +723,21 @@ private static boolean isNumberNext(StreamTokenizer stream) throws IOException {
710723
return type == StreamTokenizer.TT_WORD;
711724
}
712725

726+
private static boolean isZOrMNext(StreamTokenizer stream) {
727+
String token;
728+
try {
729+
token = nextWord(stream);
730+
if (token.equals(Z) || token.equals(M)) {
731+
return true;
732+
}
733+
stream.pushBack();
734+
return false;
735+
} catch (ParseException | IOException e) {
736+
return false;
737+
}
738+
739+
}
740+
713741
private static String nextEmptyOrOpen(StreamTokenizer stream) throws IOException, ParseException {
714742
final String next = nextWord(stream);
715743
if (next.equals(EMPTY) || next.equals(LPAREN)) {

libs/geo/src/test/java/org/elasticsearch/geometry/BaseGeometryTestCase.java

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
abstract class BaseGeometryTestCase<T extends Geometry> extends AbstractWireTestCase<T> {
2323

24+
public static final String ZorMMustIncludeThreeValuesMsg =
25+
"When specifying 'Z' or 'M', coordinates must include three values. Only two coordinates were provided";
26+
2427
@Override
2528
protected final T createTestInstance() {
2629
boolean hasAlt = randomBoolean();

libs/geo/src/test/java/org/elasticsearch/geometry/GeometryCollectionTests.java

+30
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.text.ParseException;
2020
import java.util.Arrays;
2121
import java.util.Collections;
22+
import java.util.List;
2223

2324
import static org.hamcrest.Matchers.containsString;
2425

@@ -93,6 +94,35 @@ private int countNestedGeometryCollections(GeometryCollection<?> geometry) {
9394
return count;
9495
}
9596

97+
public void testParseGeometryCollectionZorMWithThreeCoordinates() throws IOException, ParseException {
98+
GeometryValidator validator = GeographyValidator.instance(true);
99+
100+
GeometryCollection<Geometry> expected = new GeometryCollection<>(
101+
Arrays.asList(
102+
new Point(20.0, 10.0, 100.0),
103+
new Line(new double[] { 10.0, 20.0 }, new double[] { 5.0, 15.0 }, new double[] { 50.0, 150.0 })
104+
)
105+
);
106+
107+
String point = "(POINT Z (20.0 10.0 100.0)";
108+
String lineString = "LINESTRING M (10.0 5.0 50.0, 20.0 15.0 150.0)";
109+
assertEquals(expected, WellKnownText.fromWKT(validator, true, "GEOMETRYCOLLECTION Z " + point + ", " + lineString + ")"));
110+
111+
assertEquals(expected, WellKnownText.fromWKT(validator, true, "GEOMETRYCOLLECTION M " + point + ", " + lineString + ")"));
112+
}
113+
114+
public void testParseGeometryCollectionZorMWithTwoCoordinatesThrowsException() {
115+
GeometryValidator validator = GeographyValidator.instance(true);
116+
List<String> gcWkt = List.of(
117+
"GEOMETRYCOLLECTION Z (POINT (20.0 10.0), LINESTRING (10.0 5.0, 20.0 15.0))",
118+
"GEOMETRYCOLLECTION M (POINT (20.0 10.0), LINESTRING (10.0 5.0, 20.0 15.0))"
119+
);
120+
for (String gc : gcWkt) {
121+
IllegalArgumentException ex = expectThrows(IllegalArgumentException.class, () -> WellKnownText.fromWKT(validator, true, gc));
122+
assertEquals(ZorMMustIncludeThreeValuesMsg, ex.getMessage());
123+
}
124+
}
125+
96126
@Override
97127
protected GeometryCollection<Geometry> mutateInstance(GeometryCollection<Geometry> instance) {
98128
return null;// TODO implement https://github.com/elastic/elasticsearch/issues/25929

libs/geo/src/test/java/org/elasticsearch/geometry/LineTests.java

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.io.IOException;
1919
import java.text.ParseException;
20+
import java.util.List;
2021

2122
public class LineTests extends BaseGeometryTestCase<Line> {
2223
@Override
@@ -82,6 +83,25 @@ public void testWKTValidation() {
8283
assertEquals("found Z value [6.0] but [ignore_z_value] parameter is [false]", ex.getMessage());
8384
}
8485

86+
public void testParseLineZorMWithThreeCoordinates() throws IOException, ParseException {
87+
GeometryValidator validator = GeographyValidator.instance(true);
88+
89+
Line expectedZ = new Line(new double[] { 20.0, 30.0 }, new double[] { 10.0, 15.0 }, new double[] { 100.0, 200.0 });
90+
assertEquals(expectedZ, WellKnownText.fromWKT(validator, true, "LINESTRING Z (20.0 10.0 100.0, 30.0 15.0 200.0)"));
91+
92+
Line expectedM = new Line(new double[] { 20.0, 30.0 }, new double[] { 10.0, 15.0 }, new double[] { 100.0, 200.0 });
93+
assertEquals(expectedM, WellKnownText.fromWKT(validator, true, "LINESTRING M (20.0 10.0 100.0, 30.0 15.0 200.0)"));
94+
}
95+
96+
public void testParseLineZorMWithTwoCoordinatesThrowsException() {
97+
GeometryValidator validator = GeographyValidator.instance(true);
98+
List<String> linesWkt = List.of("LINESTRING Z (20.0 10.0, 30.0 15.0)", "LINESTRING M (20.0 10.0, 30.0 15.0)");
99+
for (String line : linesWkt) {
100+
IllegalArgumentException ex = expectThrows(IllegalArgumentException.class, () -> WellKnownText.fromWKT(validator, true, line));
101+
assertEquals(ZorMMustIncludeThreeValuesMsg, ex.getMessage());
102+
}
103+
}
104+
85105
@Override
86106
protected Line mutateInstance(Line instance) {
87107
return null;// TODO implement https://github.com/elastic/elasticsearch/issues/25929

libs/geo/src/test/java/org/elasticsearch/geometry/MultiLineTests.java

+48
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,54 @@ public void testValidation() {
6464
);
6565
}
6666

67+
public void testParseMultiLineZorMWithThreeCoordinates() throws IOException, ParseException {
68+
GeometryValidator validator = GeographyValidator.instance(true);
69+
MultiLine expectedZ = new MultiLine(
70+
List.of(
71+
new Line(new double[] { 20.0, 30.0 }, new double[] { 10.0, 15.0 }, new double[] { 100.0, 200.0 }),
72+
new Line(new double[] { 40.0, 50.0 }, new double[] { 20.0, 25.0 }, new double[] { 300.0, 400.0 })
73+
)
74+
);
75+
assertEquals(
76+
expectedZ,
77+
WellKnownText.fromWKT(
78+
validator,
79+
true,
80+
"MULTILINESTRING Z ((20.0 10.0 100.0, 30.0 15.0 200.0), (40.0 20.0 300.0, 50.0 25.0 400.0))"
81+
)
82+
);
83+
84+
MultiLine expectedM = new MultiLine(
85+
List.of(
86+
new Line(new double[] { 20.0, 30.0 }, new double[] { 10.0, 15.0 }, new double[] { 100.0, 200.0 }),
87+
new Line(new double[] { 40.0, 50.0 }, new double[] { 20.0, 25.0 }, new double[] { 300.0, 400.0 })
88+
)
89+
);
90+
assertEquals(
91+
expectedM,
92+
WellKnownText.fromWKT(
93+
validator,
94+
true,
95+
"MULTILINESTRING M ((20.0 10.0 100.0, 30.0 15.0 200.0), (40.0 20.0 300.0, 50.0 25.0 400.0))"
96+
)
97+
);
98+
}
99+
100+
public void testParseMultiLineZorMWithTwoCoordinatesThrowsException() {
101+
GeometryValidator validator = GeographyValidator.instance(true);
102+
List<String> multiLinesWkt = List.of(
103+
"MULTILINESTRING Z ((20.0 10.0, 30.0 15.0), (40.0 20.0, 50.0 25.0))",
104+
"MULTILINESTRING M ((20.0 10.0, 30.0 15.0), (40.0 20.0, 50.0 25.0))"
105+
);
106+
for (String multiLine : multiLinesWkt) {
107+
IllegalArgumentException ex = expectThrows(
108+
IllegalArgumentException.class,
109+
() -> WellKnownText.fromWKT(validator, true, multiLine)
110+
);
111+
assertEquals(ZorMMustIncludeThreeValuesMsg, ex.getMessage());
112+
}
113+
}
114+
67115
@Override
68116
protected MultiLine mutateInstance(MultiLine instance) {
69117
return null;// TODO implement https://github.com/elastic/elasticsearch/issues/25929

0 commit comments

Comments
 (0)