Skip to content

Commit 55ab477

Browse files
Merge pull request #170 from elastic/master
🤖 ESQL: Merge upstream
2 parents 758d26b + 26c256c commit 55ab477

File tree

188 files changed

+2362
-867
lines changed

Some content is hidden

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

188 files changed

+2362
-867
lines changed

build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/MissingJavadocTypeCheck.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
import com.puppycrawl.tools.checkstyle.utils.ScopeUtil;
3333

3434
import java.util.Arrays;
35-
import java.util.Collections;
36-
import java.util.List;
35+
import java.util.Set;
3736
import java.util.regex.Pattern;
37+
import java.util.stream.Collectors;
3838

3939
/**
4040
* This is a copy of Checkstyle's {@link com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck},
@@ -59,10 +59,10 @@ public class MissingJavadocTypeCheck extends AbstractCheck {
5959
private Pattern ignorePattern = Pattern.compile("^$");
6060

6161
/**
62-
* Specify the list of annotations that allow missed documentation.
62+
* Specify the set of annotations that allow missed documentation.
6363
* Only short names are allowed, e.g. {@code Generated}.
6464
*/
65-
private List<String> skipAnnotations = Collections.singletonList("Generated");
65+
private Set<String> skipAnnotations = Set.of("Generated");
6666

6767
/**
6868
* Setter to specify the visibility scope where Javadoc comments are checked.
@@ -89,7 +89,7 @@ public void setExcludeScope(Scope excludeScope) {
8989
* @param userAnnotations user's value.
9090
*/
9191
public void setSkipAnnotations(String... userAnnotations) {
92-
skipAnnotations = Arrays.asList(userAnnotations);
92+
skipAnnotations = Arrays.stream(userAnnotations).collect(Collectors.toSet());
9393
}
9494

9595
/**
@@ -149,10 +149,7 @@ private boolean shouldCheck(final DetailAST ast) {
149149

150150
return customScope.isIn(scope)
151151
&& (surroundingScope == null || surroundingScope.isIn(scope))
152-
&& (excludeScope == null
153-
|| !customScope.isIn(excludeScope)
154-
|| surroundingScope != null
155-
&& !surroundingScope.isIn(excludeScope))
152+
&& (excludeScope == null || !customScope.isIn(excludeScope) || surroundingScope != null && !surroundingScope.isIn(excludeScope))
156153
&& !AnnotationUtil.containsAnnotation(ast, skipAnnotations)
157154
&& ignorePattern.matcher(outerTypeName).find() == false;
158155
}

docs/changelog/88187.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 88187
2+
summary: Add deployed native models to `inference_stats` in trained model stats response
3+
area: Machine Learning
4+
type: enhancement
5+
issues: []

docs/changelog/88271.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 88271
2+
summary: "Fix: extract matrix stats using `bucket_selector` `buckets_path`"
3+
area: Aggregations
4+
type: bug
5+
issues:
6+
- 87454

docs/changelog/88297.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 88297
2+
summary: Print full exception when console is non-interactive
3+
area: Infra/Core
4+
type: enhancement
5+
issues: []

docs/reference/aggregations/bucket/composite-aggregation.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ GET /_search
736736

737737
NOTE: The `after_key` is *usually* the key to the last bucket returned in
738738
the response, but that isn't guaranteed. Always use the returned `after_key` instead
739-
of derriving it from the buckets.
739+
of deriving it from the buckets.
740740

741741
==== Early termination
742742

docs/reference/aggregations/metrics/cardinality-aggregation.asciidoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,24 @@ POST /sales/_search?size=0
237237
--------------------------------------------------
238238
// TEST[setup:sales]
239239
<1> Documents without a value in the `tag` field will fall into the same bucket as documents that have the value `N/A`.
240+
==== Execution Hint
241+
242+
There are different mechanisms by which cardinality aggregations can be executed:
243+
244+
- by using field values directly (`direct`)
245+
- by using global ordinals of the field and resolving those values after
246+
finishing a shard (`global_ordinals`)
247+
- by using segment ordinal values and resolving those values after each
248+
segment (`segment_ordinals`)
249+
250+
Additionally, there are two "heuristic based" modes. These modes will cause
251+
Elasticsearch to use some data about the state of the index to choose an
252+
appropriate execution method. The two heuristics are:
253+
- `save_time_heuristic` - this is the default in Elasticsearch 8.4 and later.
254+
- `save_memory_heuristic` - this was the default in Elasticsearch 8.3 and
255+
earlier
256+
257+
When not specified, Elasticsearch will apply a heuristic to chose the
258+
appropriate mode. Also note that some data (i.e. non-ordinal fields), `direct`
259+
is the only option, and the hint will be ignored in these cases. Generally
260+
speaking, it should not be necessary to set this value.

docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ Bytes of storage required per node.
8585
(integer)
8686
Bytes of memory required per node.
8787

88+
`processors`::
89+
(float)
90+
Number of processors (vCPUs) required per node.
91+
8892
=======
8993
`total`::
9094
(object)
@@ -100,6 +104,11 @@ Total bytes of storage required for the policy.
100104
`memory`::
101105
(integer)
102106
Total bytes of memory required for the policy.
107+
108+
`processors`::
109+
(float)
110+
Total number of processors (vCPUs) required for the policy.
111+
103112
=======
104113
======
105114
`current_capacity`::
@@ -125,6 +134,10 @@ Maximum bytes of storage of a node.
125134
(integer)
126135
Maximum bytes of memory of a node.
127136

137+
`processors`::
138+
(float)
139+
Maximum number of processors (vCPUs) of a node.
140+
128141
=======
129142
`total`::
130143
(object)
@@ -140,6 +153,10 @@ Current bytes of storage available for the policy.
140153
`memory`::
141154
(integer)
142155
Current bytes of memory available for the policy.
156+
157+
`processors`::
158+
Current number of processors (vCPUs) available for the policy.
159+
143160
=======
144161
======
145162
`current_nodes`::
@@ -191,6 +208,10 @@ Bytes of storage required per node.
191208
(integer)
192209
Bytes of memory required per node.
193210

211+
`processors`::
212+
(float)
213+
Number of processors (vCPUs) required per node.
214+
194215
==========
195216
`total`::
196217
(object)
@@ -206,6 +227,11 @@ Total bytes of storage required for the policy.
206227
`memory`::
207228
(integer)
208229
Total bytes of memory required for the policy.
230+
231+
`processors`::
232+
(float)
233+
Total number of processors (vCPUs) required for the policy.
234+
209235
==========
210236
=========
211237
`reason_summary`::

docs/reference/autoscaling/deciders/fixed-decider.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Required amount of node-level storage. Defaults to `-1` (disabled).
1919
(Optional, <<byte-units,byte value>>)
2020
Required amount of node-level memory. Defaults to `-1` (disabled).
2121

22+
`processors`::
23+
(Optional, float)
24+
Required number of processors. Defaults to disabled.
25+
2226
`nodes`::
2327
(Optional, integer)
2428
Number of nodes to use when calculating capacity. Defaults to `1`.
@@ -38,6 +42,7 @@ PUT /_autoscaling/policy/my_autoscaling_policy
3842
"fixed": {
3943
"storage": "1tb",
4044
"memory": "32gb",
45+
"processors": 2.3,
4146
"nodes": 8
4247
}
4348
}

docs/reference/index-modules/allocation/data_tier_allocation.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ mounted indices>> exclusively.
3232
are nodes with the `data_warm` role. If there are no nodes in the warm tier,
3333
but there are nodes with the `data_hot` role, the index is allocated to
3434
the hot tier.
35-
Used in conjuction with <<data-tier-allocation,data tiers>>.
35+
Used in conjunction with <<data-tier-allocation,data tiers>>.

docs/reference/mapping/params/format.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.htm
3838
==== Built In Formats
3939

4040
Most of the below formats have a `strict` companion format, which means that
41-
year, month and day parts of the week must use respectively 4, 2 and 2 digits
41+
year, month and day parts of the month must use respectively 4, 2 and 2 digits
4242
exactly, potentially prepending zeros. For instance a date like `5/11/1` would
4343
be considered invalid and would need to be rewritten to `2005/11/01` to be
4444
accepted by the date parser.

docs/reference/mapping/runtime.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ against runtime fields.
110110
You map runtime fields by adding a `runtime` section under the mapping
111111
definition and defining
112112
<<modules-scripting-using,a Painless script>>. This script has access to the
113-
entire context of a document, including the original `_source` and any mapped
114-
fields plus their values. At query time, the script runs and generates values
115-
for each scripted field that is required for the query.
113+
entire context of a document, including the original `_source` via `params._source`
114+
and any mapped fields plus their values. At query time, the script runs and
115+
generates values for each scripted field that is required for the query.
116116

117117
.Emitting runtime field values
118118
****
@@ -1358,9 +1358,9 @@ field within a document. A grok pattern is like a regular expression that
13581358
supports aliased expressions that you can reuse.
13591359

13601360
The script matches on the `%{COMMONAPACHELOG}` log pattern, which understands
1361-
the structure of Apache logs. If the pattern matches, the script emits the
1362-
value of the matching IP address. If the pattern doesn't match
1363-
(`clientip != null`), the script just returns the field value without crashing.
1361+
the structure of Apache logs. If the pattern matches (`clientip != null`),
1362+
the script emits the value of the matching IP address. If the pattern doesn't
1363+
match, the script just returns the field value without crashing.
13641364

13651365
[source,console]
13661366
----

docs/reference/scripting/common-script-uses.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ field as a runtime field in the mapping. The following runtime script defines a
7676
grok pattern that extracts structured fields out of the `message` field.
7777

7878
The script matches on the `%{COMMONAPACHELOG}` log pattern, which understands
79-
the structure of Apache logs. If the pattern matches, the script emits the
80-
value matching the IP address. If the pattern doesn't match
81-
(`clientip != null`), the script just returns the field value without crashing.
79+
the structure of Apache logs. If the pattern matches (`clientip != null`), the
80+
script emits the value of the matching IP address. If the pattern doesn't match,
81+
the script just returns the field value without crashing.
8282

8383
[source,console]
8484
----
@@ -418,4 +418,4 @@ defined it in the dissect pattern!
418418
}
419419
----
420420
// TESTRESPONSE[s/"took" : 2/"took": "$body.took"/]
421-
// TESTRESPONSE[s/"_id" : "GXx3H3kBKGE42WRNlddJ"/"_id": $body.hits.hits.0._id/]
421+
// TESTRESPONSE[s/"_id" : "GXx3H3kBKGE42WRNlddJ"/"_id": $body.hits.hits.0._id/]

docs/reference/snapshot-restore/apis/repo-analysis-api.asciidoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ You should run the analysis on a multi-node cluster of a similar size to your
6363
production cluster so that it can detect any problems that only arise when the
6464
repository is accessed by many nodes at once.
6565

66+
If the analysis fails then {es} detected that your repository behaved
67+
unexpectedly. This usually means you are using a third-party storage system
68+
with an incorrect or incompatible implementation of the API it claims to
69+
support. If so, this storage system is not suitable for use as a snapshot
70+
repository. You will need to work with the supplier of your storage system to
71+
address the incompatibilities that {es} detects. See
72+
<<self-managed-repo-types>> for more information.
73+
6674
If the analysis is successful this API returns details of the testing process,
6775
optionally including how long each operation took. You can use this information
6876
to determine the performance of your storage system. If any operation fails or

docs/reference/sql/concepts.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ In practice this means that while in SQL one can potentially have multiple catal
4848

4949
|`cluster`
5050
|`cluster` (federated)
51-
|Traditionally in SQL, _cluster_ refers to a single RDMBS instance which contains a number of ++catalog++s or ++database++s (see above). The same word can be reused inside {es} as well however its semantic clarified a bit.
51+
|Traditionally in SQL, _cluster_ refers to a single RDBMS instance which contains a number of ++catalog++s or ++database++s (see above). The same word can be reused inside {es} as well however its semantic clarified a bit.
5252

5353
While RDBMS tend to have only one running instance, on a single machine (_not_ distributed), {es} goes the opposite way and by default, is distributed and multi-instance.
5454

docs/reference/sql/endpoints/odbc/configuration.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Should the driver follow HTTP redirects of the requests to the server?
290290
+
291291
* Use local timezone
292292
+
293-
This setting controlls the timezone of:
293+
This setting controls the timezone of:
294294
+
295295
** the context in which the query will execute (especially relevant for functions dealing with timestamp components);
296296

@@ -302,7 +302,7 @@ timezone.
302302
* Auto-escape PVAs
303303
+
304304
The pattern-value arguments make use of `_` and `%` as special characters to
305-
build patern matching values. Some applications however use these chars as
305+
build pattern matching values. Some applications however use these chars as
306306
regular ones, which can lead to {es-sql} returning more data than the app
307307
intended. With the auto escaping, the driver will inspect the arguments and
308308
will escape these special characters if not already done by the application.

gradle/build.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apache-rat = "org.apache.rat:apache-rat:0.11"
1111
asm = { group = "org.ow2.asm", name="asm", version.ref="asm" }
1212
asm-tree = { group = "org.ow2.asm", name="asm-tree", version.ref="asm" }
1313
bytebuddy = "net.bytebuddy:byte-buddy:1.12.10"
14-
checkstyle = "com.puppycrawl.tools:checkstyle:10.1"
14+
checkstyle = "com.puppycrawl.tools:checkstyle:10.3"
1515
commons-codec = "commons-codec:commons-codec:1.11"
1616
commmons-io = "commons-io:commons-io:2.2"
1717
docker-compose = "com.avast.gradle:gradle-docker-compose-plugin:0.14.13"

modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,26 @@ public XContentBuilder doXContentBody(XContentBuilder builder, Params params) th
204204
public Object getProperty(List<String> path) {
205205
if (path.isEmpty()) {
206206
return this;
207+
} else if (path.size() == 2) {
208+
if (results == null) {
209+
return emptyMap();
210+
}
211+
final String field = path.get(0)
212+
.replaceAll("^\"", "") // remove leading "
213+
.replaceAll("^'", "") // remove leading '
214+
.replaceAll("\"$", "") // remove trailing "
215+
.replaceAll("'$", ""); // remove trailing '
216+
final String element = path.get(1);
217+
return switch (element) {
218+
case "counts" -> results.getFieldCount(field);
219+
case "means" -> results.getMean(field);
220+
case "variances" -> results.getVariance(field);
221+
case "skewness" -> results.getSkewness(field);
222+
case "kurtosis" -> results.getKurtosis(field);
223+
case "covariance" -> results.getCovariance(field, field);
224+
case "correlation" -> results.getCorrelation(field, field);
225+
default -> throw new IllegalArgumentException("Found unknown path element [" + element + "] in [" + getName() + "]");
226+
};
207227
} else if (path.size() == 1) {
208228
String element = path.get(0);
209229
if (results == null) {

modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.lang.invoke.MethodType;
2020
import java.util.BitSet;
2121
import java.util.Collections;
22+
import java.util.HashMap;
2223
import java.util.Iterator;
2324
import java.util.List;
2425
import java.util.Map;
@@ -146,6 +147,8 @@ private ArrayLengthHelper() {}
146147
/** factory for arraylength MethodHandle (intrinsic) from Java 9 (pkg-private for tests) */
147148
static final MethodHandle JAVA9_ARRAY_LENGTH_MH_FACTORY;
148149

150+
public static final Map<Class<?>, MethodHandle> DEF_TO_BOXED_TYPE_IMPLICIT_CAST;
151+
149152
static {
150153
final MethodHandles.Lookup methodHandlesLookup = MethodHandles.publicLookup();
151154

@@ -182,6 +185,43 @@ private ArrayLengthHelper() {}
182185
arrayLengthMHFactory = null;
183186
}
184187
JAVA9_ARRAY_LENGTH_MH_FACTORY = arrayLengthMHFactory;
188+
189+
Map<Class<?>, MethodHandle> defToBoxedTypeImplicitCast = new HashMap<>();
190+
191+
try {
192+
defToBoxedTypeImplicitCast.put(
193+
Byte.class,
194+
methodHandlesLookup.findStatic(Def.class, "defToByteImplicit", MethodType.methodType(Byte.class, Object.class))
195+
);
196+
defToBoxedTypeImplicitCast.put(
197+
Short.class,
198+
methodHandlesLookup.findStatic(Def.class, "defToShortImplicit", MethodType.methodType(Short.class, Object.class))
199+
);
200+
defToBoxedTypeImplicitCast.put(
201+
Character.class,
202+
methodHandlesLookup.findStatic(Def.class, "defToCharacterImplicit", MethodType.methodType(Character.class, Object.class))
203+
);
204+
defToBoxedTypeImplicitCast.put(
205+
Integer.class,
206+
methodHandlesLookup.findStatic(Def.class, "defToIntegerImplicit", MethodType.methodType(Integer.class, Object.class))
207+
);
208+
defToBoxedTypeImplicitCast.put(
209+
Long.class,
210+
methodHandlesLookup.findStatic(Def.class, "defToLongImplicit", MethodType.methodType(Long.class, Object.class))
211+
);
212+
defToBoxedTypeImplicitCast.put(
213+
Float.class,
214+
methodHandlesLookup.findStatic(Def.class, "defToFloatImplicit", MethodType.methodType(Float.class, Object.class))
215+
);
216+
defToBoxedTypeImplicitCast.put(
217+
Double.class,
218+
methodHandlesLookup.findStatic(Def.class, "defToDoubleImplicit", MethodType.methodType(Double.class, Object.class))
219+
);
220+
} catch (NoSuchMethodException | IllegalAccessException exception) {
221+
throw new IllegalStateException(exception);
222+
}
223+
224+
DEF_TO_BOXED_TYPE_IMPLICIT_CAST = Collections.unmodifiableMap(defToBoxedTypeImplicitCast);
185225
}
186226

187227
/** Hack to rethrow unknown Exceptions from {@link MethodHandle#invokeExact}: */

0 commit comments

Comments
 (0)