Skip to content

Commit 368f8be

Browse files
authored
Merge branch 'main' into markjhoy/default_token_pruning_sparse_vector
2 parents c0704df + e23a5e7 commit 368f8be

File tree

28 files changed

+687
-140
lines changed

28 files changed

+687
-140
lines changed

docs/changelog/128702.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 128702
2+
summary: Fix missing highlighting in `match_all` queries for `semantic_text` fields
3+
area: Search
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ tests:
495495
- class: org.elasticsearch.packaging.test.DockerTests
496496
method: test040JavaUsesTheOsProvidedKeystore
497497
issue: https://github.com/elastic/elasticsearch/issues/128230
498-
- class: org.elasticsearch.xpack.rank.rrf.LinearRankClientYamlTestSuiteIT
499-
method: test {yaml=linear/10_linear_retriever/should normalize initial scores with l2_norm}
500-
issue: https://github.com/elastic/elasticsearch/issues/128774
501498
- class: org.elasticsearch.index.codec.vectors.es818.ES818HnswBinaryQuantizedVectorsFormatTests
502499
method: testSimpleOffHeapSizeFSDir
503500
issue: https://github.com/elastic/elasticsearch/issues/128799
@@ -507,18 +504,6 @@ tests:
507504
- class: org.elasticsearch.index.store.DirectIOIT
508505
method: testDirectIOUsed
509506
issue: https://github.com/elastic/elasticsearch/issues/128829
510-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
511-
method: test {p0=esql/190_lookup_join/alias-repeated-index}
512-
issue: https://github.com/elastic/elasticsearch/issues/128849
513-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
514-
method: test {p0=esql/190_lookup_join/alias-repeated-alias}
515-
issue: https://github.com/elastic/elasticsearch/issues/128850
516-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
517-
method: test {p0=esql/190_lookup_join/alias-pattern-single}
518-
issue: https://github.com/elastic/elasticsearch/issues/128855
519-
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
520-
method: test {p0=esql/191_lookup_join_on_datastreams/data streams supported in LOOKUP JOIN}
521-
issue: https://github.com/elastic/elasticsearch/issues/128856
522507
- class: org.elasticsearch.upgrades.IndexSortUpgradeIT
523508
method: testIndexSortForNumericTypes {upgradedNodes=3}
524509
issue: https://github.com/elastic/elasticsearch/issues/128861

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/AbstractRollingUpgradeTestCase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public String get() {
4545
.setting("xpack.security.enabled", "false")
4646
.feature(FeatureFlag.TIME_SERIES_MODE);
4747

48+
// Avoid triggering bogus assertion when serialized parsed mappings don't match with original mappings, because _source key is
49+
// inconsistent
4850
if (oldVersion.before(Version.fromString("8.18.0"))) {
4951
cluster.jvmArg("-da:org.elasticsearch.index.mapper.DocumentMapper");
5052
cluster.jvmArg("-da:org.elasticsearch.index.mapper.MapperService");
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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.upgrades;
11+
12+
import com.carrotsearch.randomizedtesting.annotations.Name;
13+
14+
import org.elasticsearch.common.settings.SecureString;
15+
import org.elasticsearch.common.settings.Settings;
16+
import org.elasticsearch.common.util.concurrent.ThreadContext;
17+
import org.elasticsearch.core.SuppressForbidden;
18+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
19+
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
20+
import org.elasticsearch.test.cluster.util.Version;
21+
import org.junit.ClassRule;
22+
import org.junit.rules.RuleChain;
23+
import org.junit.rules.TemporaryFolder;
24+
import org.junit.rules.TestRule;
25+
26+
import java.util.function.Supplier;
27+
28+
public abstract class AbstractRollingUpgradeWithSecurityTestCase extends ParameterizedRollingUpgradeTestCase {
29+
30+
private static final String USER = "test_admin";
31+
private static final String PASS = "x-pack-test-password";
32+
33+
private static final TemporaryFolder repoDirectory = new TemporaryFolder();
34+
35+
private static final ElasticsearchCluster cluster = buildCluster();
36+
37+
private static ElasticsearchCluster buildCluster() {
38+
Version oldVersion = Version.fromString(OLD_CLUSTER_VERSION);
39+
var cluster = ElasticsearchCluster.local()
40+
.distribution(DistributionType.DEFAULT)
41+
.version(getOldClusterTestVersion())
42+
.nodes(NODE_NUM)
43+
.user(USER, PASS)
44+
.setting("xpack.security.autoconfiguration.enabled", "false")
45+
.setting("path.repo", new Supplier<>() {
46+
@Override
47+
@SuppressForbidden(reason = "TemporaryFolder only has io.File methods, not nio.File")
48+
public String get() {
49+
return repoDirectory.getRoot().getPath();
50+
}
51+
});
52+
53+
// Avoid triggering bogus assertion when serialized parsed mappings don't match with original mappings, because _source key is
54+
// inconsistent
55+
if (oldVersion.before(Version.fromString("8.18.0"))) {
56+
cluster.jvmArg("-da:org.elasticsearch.index.mapper.DocumentMapper");
57+
cluster.jvmArg("-da:org.elasticsearch.index.mapper.MapperService");
58+
}
59+
return cluster.build();
60+
}
61+
62+
@ClassRule
63+
public static TestRule ruleChain = RuleChain.outerRule(repoDirectory).around(cluster);
64+
65+
protected AbstractRollingUpgradeWithSecurityTestCase(@Name("upgradedNodes") int upgradedNodes) {
66+
super(upgradedNodes);
67+
}
68+
69+
@Override
70+
protected ElasticsearchCluster getUpgradeCluster() {
71+
return cluster;
72+
}
73+
74+
protected Settings restClientSettings() {
75+
String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray()));
76+
return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", token).build();
77+
}
78+
}

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/DownsampleIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import static org.hamcrest.Matchers.equalTo;
2727

28-
public class DownsampleIT extends AbstractRollingUpgradeTestCase {
28+
public class DownsampleIT extends AbstractRollingUpgradeWithSecurityTestCase {
2929

3030
private static final String FIXED_INTERVAL = "1h";
3131
private String index;

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsIndexModeRollingUpgradeIT.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
import org.elasticsearch.client.Response;
1616
import org.elasticsearch.client.RestClient;
1717
import org.elasticsearch.common.network.InetAddresses;
18+
import org.elasticsearch.common.settings.SecureString;
19+
import org.elasticsearch.common.settings.Settings;
1820
import org.elasticsearch.common.time.DateFormatter;
1921
import org.elasticsearch.common.time.FormatNames;
22+
import org.elasticsearch.common.util.concurrent.ThreadContext;
2023
import org.elasticsearch.test.cluster.ElasticsearchCluster;
2124
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
2225
import org.hamcrest.Matcher;
@@ -31,6 +34,9 @@
3134

3235
public class LogsIndexModeRollingUpgradeIT extends AbstractRollingUpgradeTestCase {
3336

37+
private static final String USER = "test_admin";
38+
private static final String PASS = "x-pack-test-password";
39+
3440
@ClassRule()
3541
public static final ElasticsearchCluster cluster = ElasticsearchCluster.local()
3642
.distribution(DistributionType.DEFAULT)
@@ -39,7 +45,8 @@ public class LogsIndexModeRollingUpgradeIT extends AbstractRollingUpgradeTestCas
3945
.module("mapper-extras")
4046
.module("x-pack-aggregate-metric")
4147
.module("x-pack-stack")
42-
.setting("xpack.security.enabled", "false")
48+
.setting("xpack.security.autoconfiguration.enabled", "false")
49+
.user(USER, PASS)
4350
.setting("xpack.license.self_generated.type", initTestSeed().nextBoolean() ? "trial" : "basic")
4451
// We upgrade from standard to logsdb, so we need to start with logsdb disabled,
4552
// then later cluster.logsdb.enabled gets set to true and next rollover data stream is in logsdb mode.
@@ -56,6 +63,11 @@ protected String getTestRestCluster() {
5663
return cluster.getHttpAddresses();
5764
}
5865

66+
protected Settings restClientSettings() {
67+
String token = basicAuthHeaderValue(USER, new SecureString(PASS.toCharArray()));
68+
return Settings.builder().put(super.restClientSettings()).put(ThreadContext.PREFIX + ".Authorization", token).build();
69+
}
70+
5971
private static final String BULK_INDEX_REQUEST = """
6072
{ "create": {} }
6173
{ "@timestamp": "%s", "host.name": "%s", "method": "%s", "ip.address": "%s", "message": "%s" }

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static org.hamcrest.Matchers.hasKey;
2424
import static org.hamcrest.Matchers.not;
2525

26-
public class LogsUsageRollingUpgradeIT extends AbstractRollingUpgradeTestCase {
26+
public class LogsUsageRollingUpgradeIT extends AbstractRollingUpgradeWithSecurityTestCase {
2727

2828
public LogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
2929
super(upgradedNodes);

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
3636
import static org.hamcrest.Matchers.notNullValue;
3737

38-
public class LogsdbIndexingRollingUpgradeIT extends AbstractRollingUpgradeTestCase {
38+
public class LogsdbIndexingRollingUpgradeIT extends AbstractRollingUpgradeWithSecurityTestCase {
3939

4040
static String BULK_ITEM_TEMPLATE =
4141
"""

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import static org.hamcrest.Matchers.hasKey;
2121
import static org.hamcrest.Matchers.not;
2222

23-
public class NoLogsUsageRollingUpgradeIT extends AbstractRollingUpgradeTestCase {
23+
public class NoLogsUsageRollingUpgradeIT extends AbstractRollingUpgradeWithSecurityTestCase {
2424

2525
public NoLogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
2626
super(upgradedNodes);

qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/ParameterizedRollingUpgradeTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ protected boolean preserveClusterUponCompletion() {
206206
}
207207

208208
@Override
209-
protected final Settings restClientSettings() {
209+
protected Settings restClientSettings() {
210210
return Settings.builder()
211211
.put(super.restClientSettings())
212212
// increase the timeout here to 90 seconds to handle long waits for a green

0 commit comments

Comments
 (0)