Skip to content

Commit 9f2d92c

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/misleading-error-message
2 parents 099707e + b335c1a commit 9f2d92c

File tree

67 files changed

+899
-494
lines changed

Some content is hidden

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

67 files changed

+899
-494
lines changed

docs/changelog/127563.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 127563
2+
summary: "ESQL: Avoid unintended attribute removal"
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 127468

docs/changelog/128153.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 128153
2+
summary: "Fix: Add `NamedWriteable` for `RuleQueryRankDoc`"
3+
area: Relevance
4+
type: bug
5+
issues:
6+
- 126071

docs/reference/query-languages/esql/esql-functions-operators.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,67 @@ mapped_pages:
1212
## Functions overview [esql-functions]
1313

1414
::::{dropdown} Aggregate functions
15+
:open:
1516
:::{include} _snippets/lists/aggregation-functions.md
1617
:::
1718
::::
1819

1920
::::{dropdown} Grouping functions
21+
:open:
2022
:::{include} _snippets/lists/grouping-functions.md
2123
:::
2224
::::
2325

2426
::::{dropdown} Conditional functions and expressions
27+
:open:
2528
:::{include} _snippets/lists/conditional-functions-and-expressions.md
2629
:::
2730
::::
2831

2932
::::{dropdown} Date and time functions
33+
:open:
3034
:::{include} _snippets/lists/date-time-functions.md
3135
:::
3236
::::
3337

3438
::::{dropdown} IP functions
39+
:open:
3540
:::{include} _snippets/lists/ip-functions.md
3641
:::
3742
::::
3843

3944
::::{dropdown} Math functions
45+
:open:
4046
:::{include} _snippets/lists/math-functions.md
4147
:::
4248
::::
4349

4450
::::{dropdown} Search functions
51+
:open:
4552
:::{include} _snippets/lists/search-functions.md
4653
:::
4754
::::
4855

4956
::::{dropdown} Spatial functions
57+
:open:
5058
:::{include} _snippets/lists/spatial-functions.md
5159
:::
5260
::::
5361

5462
::::{dropdown} String functions
63+
:open:
5564
:::{include} _snippets/lists/string-functions.md
5665
:::
5766
::::
5867

5968
::::{dropdown} Type conversion functions
69+
:open:
6070
:::{include} _snippets/lists/type-conversion-functions.md
6171
:::
6272
::::
6373

6474
::::{dropdown} Multi value functions
75+
:open:
6576
:::{include} _snippets/lists/mv-functions.md
6677
:::
6778
::::
@@ -70,6 +81,7 @@ mapped_pages:
7081
## Operators overview [esql-operators-overview]
7182

7283
::::{dropdown} Operators
84+
:open:
7385
:::{include} _snippets/lists/operators.md
7486
:::
7587
::::

libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public record BootstrapArgs(
4343
Function<Class<?>, PolicyManager.PolicyScope> scopeResolver,
4444
PathLookup pathLookup,
4545
Map<String, Path> sourcePaths,
46-
Set<Class<?>> suppressFailureLogClasses
46+
Set<Package> suppressFailureLogPackages
4747
) {
4848
public BootstrapArgs {
4949
requireNonNull(pluginPolicies);
5050
requireNonNull(scopeResolver);
5151
requireNonNull(pathLookup);
5252
requireNonNull(sourcePaths);
53-
requireNonNull(suppressFailureLogClasses);
53+
requireNonNull(suppressFailureLogPackages);
5454
}
5555
}
5656

@@ -78,7 +78,7 @@ public static BootstrapArgs bootstrapArgs() {
7878
* @param tempDir the temp directory for Elasticsearch
7979
* @param logsDir the log directory for Elasticsearch
8080
* @param pidFile path to a pid file for Elasticsearch, or {@code null} if one was not specified
81-
* @param suppressFailureLogClasses classes for which we do not need or want to log Entitlements failures
81+
* @param suppressFailureLogPackages packages for which we do not need or want to log Entitlements failures
8282
*/
8383
public static void bootstrap(
8484
Policy serverPolicyPatch,
@@ -95,7 +95,7 @@ public static void bootstrap(
9595
Path logsDir,
9696
Path tempDir,
9797
Path pidFile,
98-
Set<Class<?>> suppressFailureLogClasses
98+
Set<Package> suppressFailureLogPackages
9999
) {
100100
logger.debug("Loading entitlement agent");
101101
if (EntitlementBootstrap.bootstrapArgs != null) {
@@ -119,7 +119,7 @@ public static void bootstrap(
119119
settingResolver
120120
),
121121
sourcePaths,
122-
suppressFailureLogClasses
122+
suppressFailureLogPackages
123123
);
124124
exportInitializationToAgent();
125125
loadAgent(findAgentJar());

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private static PolicyManager createPolicyManager() {
9090
EntitlementBootstrap.bootstrapArgs().sourcePaths(),
9191
ENTITLEMENTS_MODULE,
9292
pathLookup,
93-
bootstrapArgs.suppressFailureLogClasses()
93+
bootstrapArgs.suppressFailureLogPackages()
9494
);
9595
}
9696

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ ModuleEntitlements policyEntitlements(String componentName, Path componentPath,
256256
private final Map<String, Map<String, List<Entitlement>>> pluginsEntitlements;
257257
private final Function<Class<?>, PolicyScope> scopeResolver;
258258
private final PathLookup pathLookup;
259-
private final Set<Class<?>> mutedClasses;
259+
private final Set<Package> suppressFailureLogPackages;
260260

261261
public static final String ALL_UNNAMED = "ALL-UNNAMED";
262262

@@ -311,7 +311,7 @@ public PolicyManager(
311311
Map<String, Path> sourcePaths,
312312
Module entitlementsModule,
313313
PathLookup pathLookup,
314-
Set<Class<?>> suppressFailureLogClasses
314+
Set<Package> suppressFailureLogPackages
315315
) {
316316
this.serverEntitlements = buildScopeEntitlementsMap(requireNonNull(serverPolicy));
317317
this.apmAgentEntitlements = apmAgentEntitlements;
@@ -322,7 +322,7 @@ public PolicyManager(
322322
this.sourcePaths = sourcePaths;
323323
this.entitlementsModule = entitlementsModule;
324324
this.pathLookup = requireNonNull(pathLookup);
325-
this.mutedClasses = suppressFailureLogClasses;
325+
this.suppressFailureLogPackages = suppressFailureLogPackages;
326326

327327
List<ExclusiveFileEntitlement> exclusiveFileEntitlements = new ArrayList<>();
328328
for (var e : serverEntitlements.entrySet()) {
@@ -688,8 +688,8 @@ public void checkWriteProperty(Class<?> callerClass, String property) {
688688

689689
private void notEntitled(String message, Class<?> callerClass, ModuleEntitlements entitlements) {
690690
var exception = new NotEntitledException(message);
691-
// Don't emit a log for muted classes, e.g. classes containing self tests
692-
if (mutedClasses.contains(callerClass) == false) {
691+
// Don't emit a log for suppressed packages, e.g. packages containing self tests
692+
if (suppressFailureLogPackages.contains(callerClass.getPackage()) == false) {
693693
entitlements.logger().warn("Not entitled: {}", message, exception);
694694
}
695695
throw exception;

modules/data-streams/src/main/java/org/elasticsearch/datastreams/DataStreamFeatures.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ public class DataStreamFeatures implements FeatureSpecification {
2626
"data_stream.downsample.default_aggregate_metric_fix"
2727
);
2828

29+
public static final NodeFeature LOGS_STREAM_FEATURE = new NodeFeature("logs_stream");
30+
2931
@Override
3032
public Set<NodeFeature> getFeatures() {
3133
return Set.of(DataStream.DATA_STREAM_FAILURE_STORE_FEATURE);
3234
}
3335

3436
@Override
3537
public Set<NodeFeature> getTestFeatures() {
36-
return Set.of(DATA_STREAM_FAILURE_STORE_TSDB_FIX, DOWNSAMPLE_AGGREGATE_DEFAULT_METRIC_FIX);
38+
return Set.of(DATA_STREAM_FAILURE_STORE_TSDB_FIX, DOWNSAMPLE_AGGREGATE_DEFAULT_METRIC_FIX, LOGS_STREAM_FEATURE);
3739
}
3840
}

modules/data-streams/src/main/java/org/elasticsearch/datastreams/DataStreamsPlugin.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.elasticsearch.action.datastreams.lifecycle.GetDataStreamLifecycleAction;
2525
import org.elasticsearch.action.datastreams.lifecycle.PutDataStreamLifecycleAction;
2626
import org.elasticsearch.client.internal.OriginSettingClient;
27+
import org.elasticsearch.cluster.metadata.DataStream;
2728
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
2829
import org.elasticsearch.cluster.node.DiscoveryNodes;
2930
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
@@ -70,10 +71,12 @@
7071
import org.elasticsearch.datastreams.rest.RestCreateDataStreamAction;
7172
import org.elasticsearch.datastreams.rest.RestDataStreamsStatsAction;
7273
import org.elasticsearch.datastreams.rest.RestDeleteDataStreamAction;
74+
import org.elasticsearch.datastreams.rest.RestGetDataStreamSettingsAction;
7375
import org.elasticsearch.datastreams.rest.RestGetDataStreamsAction;
7476
import org.elasticsearch.datastreams.rest.RestMigrateToDataStreamAction;
7577
import org.elasticsearch.datastreams.rest.RestModifyDataStreamsAction;
7678
import org.elasticsearch.datastreams.rest.RestPromoteDataStreamAction;
79+
import org.elasticsearch.datastreams.rest.RestUpdateDataStreamSettingsAction;
7780
import org.elasticsearch.features.NodeFeature;
7881
import org.elasticsearch.health.HealthIndicatorService;
7982
import org.elasticsearch.index.IndexSettingProvider;
@@ -280,6 +283,10 @@ public List<RestHandler> getRestHandlers(
280283
handlers.add(new RestGetDataStreamOptionsAction());
281284
handlers.add(new RestPutDataStreamOptionsAction());
282285
handlers.add(new RestDeleteDataStreamOptionsAction());
286+
if (DataStream.LOGS_STREAM_FEATURE_FLAG) {
287+
handlers.add(new RestGetDataStreamSettingsAction());
288+
handlers.add(new RestUpdateDataStreamSettingsAction());
289+
}
283290
return handlers;
284291
}
285292

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
package org.elasticsearch.datastreams.rest;
11+
12+
import org.elasticsearch.action.datastreams.GetDataStreamSettingsAction;
13+
import org.elasticsearch.client.internal.node.NodeClient;
14+
import org.elasticsearch.common.Strings;
15+
import org.elasticsearch.rest.BaseRestHandler;
16+
import org.elasticsearch.rest.RestRequest;
17+
import org.elasticsearch.rest.RestUtils;
18+
import org.elasticsearch.rest.Scope;
19+
import org.elasticsearch.rest.ServerlessScope;
20+
import org.elasticsearch.rest.action.RestCancellableNodeClient;
21+
import org.elasticsearch.rest.action.RestRefCountedChunkedToXContentListener;
22+
23+
import java.io.IOException;
24+
import java.util.List;
25+
26+
import static org.elasticsearch.rest.RestRequest.Method.GET;
27+
28+
@ServerlessScope(Scope.PUBLIC)
29+
public class RestGetDataStreamSettingsAction extends BaseRestHandler {
30+
@Override
31+
public String getName() {
32+
return "get_data_stream_settings_action";
33+
}
34+
35+
@Override
36+
public List<Route> routes() {
37+
return List.of(new Route(GET, "/_data_stream/{name}/_settings"));
38+
}
39+
40+
@Override
41+
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
42+
GetDataStreamSettingsAction.Request getDataStreamRequest = new GetDataStreamSettingsAction.Request(
43+
RestUtils.getMasterNodeTimeout(request)
44+
).indices(Strings.splitStringByCommaToArray(request.param("name")));
45+
return channel -> new RestCancellableNodeClient(client, request.getHttpChannel()).execute(
46+
GetDataStreamSettingsAction.INSTANCE,
47+
getDataStreamRequest,
48+
new RestRefCountedChunkedToXContentListener<>(channel)
49+
);
50+
}
51+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
package org.elasticsearch.datastreams.rest;
10+
11+
import org.elasticsearch.action.datastreams.UpdateDataStreamSettingsAction;
12+
import org.elasticsearch.client.internal.node.NodeClient;
13+
import org.elasticsearch.common.Strings;
14+
import org.elasticsearch.common.settings.Settings;
15+
import org.elasticsearch.rest.BaseRestHandler;
16+
import org.elasticsearch.rest.RestRequest;
17+
import org.elasticsearch.rest.RestUtils;
18+
import org.elasticsearch.rest.Scope;
19+
import org.elasticsearch.rest.ServerlessScope;
20+
import org.elasticsearch.rest.action.RestCancellableNodeClient;
21+
import org.elasticsearch.rest.action.RestRefCountedChunkedToXContentListener;
22+
import org.elasticsearch.xcontent.XContentParser;
23+
24+
import java.io.IOException;
25+
import java.util.List;
26+
27+
import static org.elasticsearch.rest.RestRequest.Method.PUT;
28+
29+
@ServerlessScope(Scope.PUBLIC)
30+
public class RestUpdateDataStreamSettingsAction extends BaseRestHandler {
31+
32+
@Override
33+
public String getName() {
34+
return "update_data_stream_settings_action";
35+
}
36+
37+
@Override
38+
public List<Route> routes() {
39+
return List.of(new Route(PUT, "/_data_stream/{name}/_settings"));
40+
}
41+
42+
@Override
43+
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
44+
Settings settings;
45+
try (XContentParser parser = request.contentParser()) {
46+
settings = Settings.fromXContent(parser);
47+
}
48+
UpdateDataStreamSettingsAction.Request putDataStreamRequest = new UpdateDataStreamSettingsAction.Request(
49+
settings,
50+
RestUtils.getMasterNodeTimeout(request),
51+
RestUtils.getAckTimeout(request)
52+
).indices(Strings.splitStringByCommaToArray(request.param("name")));
53+
return channel -> new RestCancellableNodeClient(client, request.getHttpChannel()).execute(
54+
UpdateDataStreamSettingsAction.INSTANCE,
55+
putDataStreamRequest,
56+
new RestRefCountedChunkedToXContentListener<>(channel)
57+
);
58+
}
59+
}

0 commit comments

Comments
 (0)