Skip to content

Commit

Permalink
Merge branch 'main' into fix/doc-id-url-encode
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Nov 13, 2024
2 parents 21b3a74 + 31492f5 commit 0f875e5
Show file tree
Hide file tree
Showing 47 changed files with 1,156 additions and 464 deletions.
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,11 @@ gradle.projectsEvaluated {
}
}

tasks.named("validateChangelogs") {
onlyIf { project.gradle.startParameter.taskNames.any { it.startsWith("checkPart") || it == 'functionalTests' } == false }
tasks.named("validateChangelogs").configure {
def triggeredTaskNames = gradle.startParameter.taskNames
onlyIf {
triggeredTaskNames.any { it.startsWith("checkPart") || it == 'functionalTests' } == false
}
}

tasks.named("precommit") {
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/115858.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 115858
summary: "ESQL: optimise aggregations filtered by false/null into evals"
area: ES|QL
type: enhancement
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/116408.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 116408
summary: Propagating nested `inner_hits` to the parent compound retriever
area: Ranking
type: bug
issues:
- 116397
6 changes: 6 additions & 0 deletions docs/changelog/116656.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 116656
summary: _validate does not honour ignore_unavailable
area: Search
type: bug
issues:
- 116594
11 changes: 10 additions & 1 deletion libs/entitlement/bridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@

apply plugin: 'elasticsearch.build'

configurations {
bridgeJar {
canBeConsumed = true
canBeResolved = false
}
}

artifacts {
bridgeJar(jar)
}

tasks.named('forbiddenApisMain').configure {
replaceSignatureFiles 'jdk-signatures'
}

Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,17 @@ TSDB failures go to failure store:
refresh: true
body:
- '{ "create": { "_index": "fs-k8s"} }'
- '{"@timestamp":"2021-04-28T01:00:00ZZ", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{"@timestamp":"2021-04-28T01:00:00Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "create": { "_index": "k8s"} }'
- '{ "@timestamp": "2021-04-28T01:00:00ZZ", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "@timestamp": "2021-04-28T01:00:00Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "create": { "_index": "fs-k8s"} }'
- '{ "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "create": { "_index": "fs-k8s"} }'
- '{ "@timestamp":"2000-04-28T01:00:00ZZ", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "@timestamp":"2000-04-28T01:00:00Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "create": { "_index": "k8s"} }'
- '{"metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "create": { "_index": "k8s"} }'
- '{ "@timestamp":"2000-04-28T01:00:00ZZ", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- '{ "@timestamp":"2000-04-28T01:00:00Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}'
- is_true: errors

# Successfully indexed to backing index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
}

@Override
@TestIssueLogging(issueUrl = "https://github.com/elastic/elasticsearch/issues/88841", value = "com.amazonaws.request:DEBUG")
@TestIssueLogging(
issueUrl = "https://github.com/elastic/elasticsearch/issues/88841",
value = "com.amazonaws.request:DEBUG,com.amazonaws.http.AmazonHttpClient:TRACE"
)
public void testRequestStats() throws Exception {
super.testRequestStats();
}
Expand Down Expand Up @@ -234,7 +237,10 @@ public void testAbortRequestStats() throws Exception {
assertEquals(assertionErrorMsg, mockCalls, sdkRequestCounts);
}

@TestIssueLogging(issueUrl = "https://github.com/elastic/elasticsearch/issues/101608", value = "com.amazonaws.request:DEBUG")
@TestIssueLogging(
issueUrl = "https://github.com/elastic/elasticsearch/issues/101608",
value = "com.amazonaws.request:DEBUG,com.amazonaws.http.AmazonHttpClient:TRACE"
)
public void testMetrics() throws Exception {
// Create the repository and perform some activities
final String repository = createRepository(randomRepositoryName(), false);
Expand Down
42 changes: 42 additions & 0 deletions qa/entitlements/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

apply plugin: 'elasticsearch.base-internal-es-plugin'
apply plugin: 'elasticsearch.internal-java-rest-test'
// Necessary to use tests in Serverless
apply plugin: 'elasticsearch.internal-test-artifact'

esplugin {
name 'entitlement-qa'
description 'A test module that triggers entitlement checks'
classname 'org.elasticsearch.test.entitlements.EntitlementsCheckPlugin'
}

configurations {
entitlementBridge {
canBeConsumed = false
}
}

dependencies {
clusterPlugins project(':qa:entitlements')
entitlementBridge project(':libs:entitlement:bridge')
}

tasks.named('javaRestTest') {
systemProperty "tests.entitlement-bridge.jar-name", configurations.entitlementBridge.singleFile.getName()
usesDefaultDistribution()
systemProperty "tests.security.manager", "false"
}

tasks.named("javadoc").configure {
// There seems to be some problem generating javadoc on a QA project that has a module definition
enabled = false
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.test.entitlements;

import org.elasticsearch.client.Request;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.junit.ClassRule;

import java.io.IOException;

import static org.hamcrest.Matchers.containsString;

@ESTestCase.WithoutSecurityManager
public class EntitlementsIT extends ESRestTestCase {

private static final String ENTITLEMENT_BRIDGE_JAR_NAME = System.getProperty("tests.entitlement-bridge.jar-name");

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.INTEG_TEST)
.plugin("entitlement-qa")
.systemProperty("es.entitlements.enabled", "true")
.setting("xpack.security.enabled", "false")
.jvmArg("-Djdk.attach.allowAttachSelf=true")
.jvmArg("-XX:+EnableDynamicAgentLoading")
.jvmArg("--patch-module=java.base=lib/entitlement-bridge/" + ENTITLEMENT_BRIDGE_JAR_NAME)
.jvmArg("--add-exports=java.base/org.elasticsearch.entitlement.bridge=org.elasticsearch.entitlement")
.build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}

public void testCheckSystemExit() {
var exception = expectThrows(
IOException.class,
() -> { client().performRequest(new Request("GET", "/_entitlement/_check_system_exit")); }
);
assertThat(exception.getMessage(), containsString("not_entitled_exception"));
}
}
5 changes: 5 additions & 0 deletions qa/entitlements/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module elasticsearch.qa.entitlements {
requires org.elasticsearch.server;
requires org.elasticsearch.base;
requires org.apache.logging.log4j;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.test.entitlements;

import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.IndexScopedSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestHandler;

import java.util.Collections;
import java.util.List;
import java.util.function.Predicate;
import java.util.function.Supplier;

public class EntitlementsCheckPlugin extends Plugin implements ActionPlugin {

@Override
@SuppressForbidden(reason = "Specifically testing System.exit")
public List<RestHandler> getRestHandlers(
final Settings settings,
NamedWriteableRegistry namedWriteableRegistry,
final RestController restController,
final ClusterSettings clusterSettings,
final IndexScopedSettings indexScopedSettings,
final SettingsFilter settingsFilter,
final IndexNameExpressionResolver indexNameExpressionResolver,
final Supplier<DiscoveryNodes> nodesInCluster,
Predicate<NodeFeature> clusterSupportsFeature
) {
return Collections.singletonList(new RestEntitlementsCheckSystemExitAction());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

package org.elasticsearch.test.entitlements;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;

import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.GET;

public class RestEntitlementsCheckSystemExitAction extends BaseRestHandler {

private static final Logger logger = LogManager.getLogger(RestEntitlementsCheckSystemExitAction.class);

RestEntitlementsCheckSystemExitAction() {}

@Override
public List<Route> routes() {
return List.of(new Route(GET, "/_entitlement/_check_system_exit"));
}

@Override
public String getName() {
return "check_system_exit_action";
}

@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
logger.info("RestEntitlementsCheckSystemExitAction rest handler");
return channel -> {
logger.info("Calling System.exit(123);");
System.exit(123);
};
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
setup:
- skip:
- requires:
cluster_features: [ "gte_v7.8.0" ]
reason: "index template v2 API unavailable before 7.8"
features: allowed_warnings
test_runner_features: allowed_warnings

- do:
allowed_warnings:
Expand Down Expand Up @@ -92,10 +92,9 @@ setup:

---
"Add data stream lifecycle":
- skip:
- requires:
cluster_features: ["gte_v8.11.0"]
reason: "Data stream lifecycle in index templates was updated after 8.10"
features: allowed_warnings

- do:
allowed_warnings:
Expand Down Expand Up @@ -127,10 +126,9 @@ setup:

---
"Get data stream lifecycle with default rollover":
- skip:
- requires:
cluster_features: ["gte_v8.11.0"]
reason: "Data stream lifecycle in index templates was updated after 8.10"
features: allowed_warnings

- do:
allowed_warnings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public void testWildcardBehaviour() throws Exception {
verify(indicesStats(indices), false);
verify(forceMerge(indices), false);
verify(refreshBuilder(indices), false);
verify(validateQuery(indices), true);
verify(validateQuery(indices), false);
verify(getAliases(indices), false);
verify(getFieldMapping(indices), false);
verify(getMapping(indices), false);
Expand Down Expand Up @@ -338,7 +338,7 @@ public void testWildcardBehaviour() throws Exception {
verify(indicesStats(indices), false);
verify(forceMerge(indices), false);
verify(refreshBuilder(indices), false);
verify(validateQuery(indices), true);
verify(validateQuery(indices), false);
verify(getAliases(indices), false);
verify(getFieldMapping(indices), false);
verify(getMapping(indices), false);
Expand Down
Loading

0 comments on commit 0f875e5

Please sign in to comment.