Skip to content

Commit f7f7611

Browse files
authored
Merge branch 'main' into feature/add-tracing
2 parents af24ebf + acdc6a4 commit f7f7611

File tree

64 files changed

+3141
-260
lines changed

Some content is hidden

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

64 files changed

+3141
-260
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
package org.elasticsearch.gradle.internal.transport;
1111

12+
import java.nio.file.Path;
1213
import java.util.ArrayList;
1314
import java.util.List;
1415

1516
record TransportVersionDefinition(String name, List<TransportVersionId> ids) {
16-
public static TransportVersionDefinition fromString(String filename, String contents) {
17+
public static TransportVersionDefinition fromString(Path file, String contents) {
18+
String filename = file.getFileName().toString();
1719
assert filename.endsWith(".csv");
1820
String name = filename.substring(0, filename.length() - 4);
1921
List<TransportVersionId> ids = new ArrayList<>();
@@ -23,7 +25,7 @@ public static TransportVersionDefinition fromString(String filename, String cont
2325
try {
2426
ids.add(TransportVersionId.fromString(rawId));
2527
} catch (NumberFormatException e) {
26-
throw new IllegalStateException("Failed to parse id " + rawId + " in " + filename, e);
28+
throw new IllegalStateException("Failed to parse id " + rawId + " in " + file, e);
2729
}
2830
}
2931
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99

1010
package org.elasticsearch.gradle.internal.transport;
1111

12+
import java.nio.file.Path;
13+
1214
record TransportVersionLatest(String branch, String name, TransportVersionId id) {
13-
public static TransportVersionLatest fromString(String filename, String contents) {
15+
public static TransportVersionLatest fromString(Path file, String contents) {
16+
String filename = file.getFileName().toString();
1417
assert filename.endsWith(".csv");
1518
String branch = filename.substring(0, filename.length() - 4);
1619

1720
String[] parts = contents.split(",");
1821
if (parts.length != 2) {
19-
throw new IllegalStateException("Invalid transport version latest file [" + filename + "]: " + contents);
22+
throw new IllegalStateException("Invalid transport version latest file [" + file + "]: " + contents);
2023
}
2124

2225
return new TransportVersionLatest(branch, parts[0], TransportVersionId.fromString(parts[1]));

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.gradle.process.ExecResult;
1717

1818
import java.io.ByteArrayOutputStream;
19-
import java.io.File;
2019
import java.io.IOException;
2120
import java.nio.charset.StandardCharsets;
2221
import java.nio.file.Files;
@@ -104,7 +103,7 @@ Map<String, TransportVersionDefinition> getNamedDefinitions() throws IOException
104103

105104
/** Get a named definition from main if it exists there, or null otherwise */
106105
TransportVersionDefinition getNamedDefinitionFromMain(String name) {
107-
String resourcePath = getNamedDefinitionRelativePath(name).toString();
106+
Path resourcePath = getNamedDefinitionRelativePath(name);
108107
return getMainFile(resourcePath, TransportVersionDefinition::fromString);
109108
}
110109

@@ -130,7 +129,7 @@ Map<String, TransportVersionDefinition> getUnreferencedDefinitions() throws IOEx
130129

131130
/** Get a named definition from main if it exists there, or null otherwise */
132131
TransportVersionDefinition getUnreferencedDefinitionFromMain(String name) {
133-
String resourcePath = getUnreferencedDefinitionRelativePath(name).toString();
132+
Path resourcePath = getUnreferencedDefinitionRelativePath(name);
134133
return getMainFile(resourcePath, TransportVersionDefinition::fromString);
135134
}
136135

@@ -145,7 +144,7 @@ Map<String, TransportVersionLatest> getLatestByReleaseBranch() throws IOExceptio
145144
try (var stream = Files.list(transportResourcesDir.resolve(LATEST_DIR))) {
146145
for (var latestFile : stream.toList()) {
147146
String contents = Files.readString(latestFile, StandardCharsets.UTF_8).strip();
148-
var latest = TransportVersionLatest.fromString(latestFile.getFileName().toString(), contents);
147+
var latest = TransportVersionLatest.fromString(latestFile, contents);
149148
latests.put(latest.name(), latest);
150149
}
151150
}
@@ -154,7 +153,7 @@ Map<String, TransportVersionLatest> getLatestByReleaseBranch() throws IOExceptio
154153

155154
/** Retrieve the latest transport version for the given release branch on main */
156155
TransportVersionLatest getLatestFromMain(String releaseBranch) {
157-
String resourcePath = getLatestRelativePath(releaseBranch).toString();
156+
Path resourcePath = getLatestRelativePath(releaseBranch);
158157
return getMainFile(resourcePath, TransportVersionLatest::fromString);
159158
}
160159

@@ -174,7 +173,7 @@ private Set<String> getMainResources() {
174173
String output = gitCommand("ls-tree", "--name-only", "-r", "main", ".");
175174

176175
HashSet<String> resources = new HashSet<>();
177-
Collections.addAll(resources, output.split(System.lineSeparator()));
176+
Collections.addAll(resources, output.split("\n")); // git always outputs LF
178177
mainResources.set(resources);
179178
}
180179
}
@@ -188,20 +187,21 @@ private Set<String> getChangedResources() {
188187
String output = gitCommand("diff", "--name-only", "main", ".");
189188

190189
HashSet<String> resources = new HashSet<>();
191-
Collections.addAll(resources, output.split(System.lineSeparator()));
190+
Collections.addAll(resources, output.split("\n")); // git always outputs LF
192191
changedResources.set(resources);
193192
}
194193
}
195194
return changedResources.get();
196195
}
197196

198197
// Read a transport version resource from the main branch, or return null if it doesn't exist on main
199-
private <T> T getMainFile(String resourcePath, BiFunction<String, String, T> parser) {
200-
if (getMainResources().contains(resourcePath) == false) {
198+
private <T> T getMainFile(Path resourcePath, BiFunction<Path, String, T> parser) {
199+
String pathString = resourcePath.toString().replace('\\', '/'); // normalize to forward slash that git uses
200+
if (getMainResources().contains(pathString) == false) {
201201
return null;
202202
}
203203

204-
String content = gitCommand("show", "main:." + File.separator + resourcePath).strip();
204+
String content = gitCommand("show", "main:./" + pathString).strip();
205205
return parser.apply(resourcePath, content);
206206
}
207207

@@ -213,7 +213,7 @@ private static Map<String, TransportVersionDefinition> readDefinitions(Path dir)
213213
try (var definitionsStream = Files.list(dir)) {
214214
for (var definitionFile : definitionsStream.toList()) {
215215
String contents = Files.readString(definitionFile, StandardCharsets.UTF_8).strip();
216-
var definition = TransportVersionDefinition.fromString(definitionFile.getFileName().toString(), contents);
216+
var definition = TransportVersionDefinition.fromString(definitionFile, contents);
217217
definitions.put(definition.name(), definition);
218218
}
219219
}

docs/changelog/133134.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 133134
2+
summary: Fix sequences with conditions involving keys and non-keys
3+
area: EQL
4+
type: bug
5+
issues: []

docs/changelog/133154.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 133154
2+
summary: Allow configuring SAML private attributes
3+
area: Authentication
4+
type: enhancement
5+
issues: []

docs/changelog/133313.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 133313
2+
summary: Do not run on transport thread
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/133314.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 133314
2+
summary: Add hits and misses timing stats to DLS cache
3+
area: Authorization
4+
type: enhancement
5+
issues: []

docs/reference/enrich-processor/convert-processor.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,41 @@ mapped_pages:
66

77
# Convert processor [convert-processor]
88

9-
109
Converts a field in the currently ingested document to a different type, such as converting a string to an integer. If the field value is an array, all members will be converted.
1110

12-
The supported types include: `integer`, `long`, `float`, `double`, `string`, `boolean`, `ip`, and `auto`.
11+
## Supported types
12+
13+
The supported types are: `integer`, `long`, `float`, `double`, `string`, `boolean`, `ip`, and `auto` (all case-insensitive).
14+
15+
| Target `type` | Supported input values |
16+
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
17+
| `integer` | `Integer` values<br><br>`Long` values in 32-bit signed integer range<br><br>`String` values representing an integer in 32-bit signed integer range in either decimal format (without a decimal point) or hex format (e.g. `"123"` or `"0x7b"`) |
18+
| `long` | `Integer` values<br><br>`Long` values<br><br>`String` values representing an integer in 64-bit signed integer range in either decimal format (without a decimal point) or hex format (e.g. `"123"` or `"0x7b"`) |
19+
| `float` | `Integer` values (may lose precision for absolute values greater than 2^24^)<br><br>`Long` values (may lose precision for absolute values greater than 2^24^)<br><br>`Float` values<br><br>`Double` values (may lose precision)<br><br>`String` values representing a floating point number in decimal, scientific, or hex format (e.g. `"123.0"`, `"123.45"`, `"1.23e2"`, or `"0x1.ecp6"`) or an integer (may lose precision, and will give positive or negative infinity if out of range for a 32-bit floating point value) |
20+
| `double` | `Integer` values<br><br>`Long` values (may lose precision for absolute values greater than 2^53^)<br><br>`Float` values<br><br>`Double` values<br><br>`String` values representing a floating point number in decimal, scientific, or hex format (e.g. `"123.0"`, `"123.45"`, `"1.23e2"`, or `"0x1.ecp6"`) or an integer (may lose precision, and will give positive or negative infinity if out of range for a 64-bit floating point value) |
21+
| `string` | All values |
22+
| `boolean` | `Boolean` values<br><br>`String` values matching `"true"` or `"false"` (case-insensitive) |
23+
| `ip` | `String` values containing a valid IPv4 or IPv6 address that can be indexed into an [IP field type](/reference/elasticsearch/mapping-reference/ip.md) |
24+
| `auto` | All values (see below) |
25+
26+
Specifying `auto` will attempt to convert a string-valued `field` into the closest non-string, non-IP type:
27+
- A whose value is `"true"` or `"false"` (case insensitive) will be converted to a `Boolean`.
28+
- A string representing an integer in decimal or hex format (e.g. `"123"` or `"0x7b"`) will be converted to an `Integer` if the number fits in a 32-bit signed integer, else to a `Long` if it fits in a 64-bit signed integer, else to a `Float` (in which case it may
29+
lose precision, and will give positive or negative infinity if out of range for a 32-bit floating point value).
30+
- A string representing a floating point number in decimal, scientific, or hex format (e.g. `"123.0"`, `"123.45"`, `"1.23e2"`, or `"0x1.ecp6"`) will be converted to a `Float` (and may lose precision, and will give positive or negative infinity if out of range for a 32-bit floating point value).
31+
32+
Using `auto` to convert a `field` which is either not a `String` or a `String` which cannot be converted will leave the
33+
field value as-is. In such a case, `target_field` will be updated with the unconverted field value.
1334

14-
Specifying `boolean` will set the field to true if its string value is equal to `true` (ignore case), to false if its string value is equal to `false` (ignore case), or it will throw an exception otherwise.
35+
:::{tip}
36+
If conversions other than those provided by this processor are required, the
37+
[`script`](/reference/enrich-processor/script-processor.md) processor may be used to implement the desired behavior.
1538

16-
Specifying `ip` will set the target field to the value of `field` if it contains a valid IPv4 or IPv6 address that can be indexed into an [IP field type](/reference/elasticsearch/mapping-reference/ip.md).
39+
The performance of the `script` processor should be as good or better than the `convert` processor.
40+
:::
1741

18-
Specifying `auto` will attempt to convert the string-valued `field` into the closest non-string, non-IP type. For example, a field whose value is `"true"` will be converted to its respective boolean type: `true`. Do note that float takes precedence of double in `auto`. A value of `"242.15"` will "automatically" be converted to `242.15` of type `float`. If a provided field cannot be appropriately converted, the processor will still process successfully and leave the field value as-is. In such a case, `target_field` will be updated with the unconverted field value.
1942

43+
## Options
2044
$$$convert-options$$$
2145

2246
| Name | Required | Default | Description |

0 commit comments

Comments
 (0)