Skip to content

Commit cc94220

Browse files
Merge branch 'main' into fixMutedFoldingTests
2 parents c8eb259 + 8ca0947 commit cc94220

File tree

45 files changed

+344
-235
lines changed

Some content is hidden

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

45 files changed

+344
-235
lines changed

muted-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,30 @@ tests:
507507
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
508508
method: test {p0=search/410_named_queries/named_queries_with_score}
509509
issue: https://github.com/elastic/elasticsearch/issues/132906
510+
- class: org.elasticsearch.packaging.test.ArchiveGenerateInitialCredentialsTests
511+
method: test40VerifyAutogeneratedCredentials
512+
issue: https://github.com/elastic/elasticsearch/issues/132877
513+
- class: org.elasticsearch.packaging.test.ArchiveGenerateInitialCredentialsTests
514+
method: test50CredentialAutogenerationOnlyOnce
515+
issue: https://github.com/elastic/elasticsearch/issues/132878
516+
- class: org.elasticsearch.upgrades.TransformSurvivesUpgradeIT
517+
method: testTransformRollingUpgrade
518+
issue: https://github.com/elastic/elasticsearch/issues/132892
519+
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
520+
method: testFetchCoerced
521+
issue: https://github.com/elastic/elasticsearch/issues/132893
522+
- class: org.elasticsearch.xpack.eql.planner.QueryTranslatorTests
523+
method: testMatchOptimization
524+
issue: https://github.com/elastic/elasticsearch/issues/132894
525+
- class: org.elasticsearch.xpack.deprecation.DeprecationHttpIT
526+
method: testUniqueDeprecationResponsesMergedTogether
527+
issue: https://github.com/elastic/elasticsearch/issues/132895
528+
- class: org.elasticsearch.search.CCSDuelIT
529+
method: testTermsAggs
530+
issue: https://github.com/elastic/elasticsearch/issues/132879
531+
- class: org.elasticsearch.search.CCSDuelIT
532+
method: testTermsAggsWithProfile
533+
issue: https://github.com/elastic/elasticsearch/issues/132880
510534

511535
# Examples:
512536
#

qa/multi-cluster-search/src/test/java/org/elasticsearch/search/CCSDuelIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ public void testFieldCollapsingSortByField() throws Exception {
670670
}
671671
}
672672

673-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/40005")
674673
public void testTermsAggs() throws Exception {
675674
assumeMultiClusterSetup();
676675
{
@@ -685,7 +684,6 @@ public void testTermsAggs() throws Exception {
685684
}
686685
}
687686

688-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/40005")
689687
public void testTermsAggsWithProfile() throws Exception {
690688
assumeMultiClusterSetup();
691689
{

qa/packaging/src/test/java/org/elasticsearch/packaging/test/ArchiveGenerateInitialCredentialsTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public void test30NoAutogenerationWhenDaemonized() throws Exception {
7878
stopElasticsearch();
7979
}
8080

81-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/84407")
8281
public void test40VerifyAutogeneratedCredentials() throws Exception {
8382
/* Windows issue awaits fix: https://github.com/elastic/elasticsearch/issues/49340 */
8483
assumeTrue("expect command isn't on Windows", distribution.platform != Distribution.Platform.WINDOWS);
@@ -97,7 +96,6 @@ public void test40VerifyAutogeneratedCredentials() throws Exception {
9796
stopElasticsearch();
9897
}
9998

100-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/84407")
10199
public void test50CredentialAutogenerationOnlyOnce() throws Exception {
102100
/* Windows issue awaits fix: https://github.com/elastic/elasticsearch/issues/49340 */
103101
assumeTrue("expect command isn't on Windows", distribution.platform != Distribution.Platform.WINDOWS);

server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/DanglingIndicesIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ public void testMustAcceptDataLossToImportDanglingIndex() throws Exception {
176176
* other will be considered dangling, and can therefore be listed and
177177
* deleted through the API
178178
*/
179-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/108288")
180179
public void testDanglingIndexCanBeDeleted() throws Exception {
181180
final Settings settings = buildSettings(1, true);
182181
internalCluster().startNodes(3, settings);

server/src/test/java/org/elasticsearch/index/mapper/LongFieldMapperTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ protected Number randomNumber() {
111111
if (randomBoolean()) {
112112
return randomDouble();
113113
}
114-
assumeFalse("https://github.com/elastic/elasticsearch/issues/70585", true);
115114
return randomDoubleBetween(Long.MIN_VALUE, Long.MAX_VALUE, true);
116115
}
117116

118-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/70585")
119117
public void testFetchCoerced() throws IOException {
120118
assertFetch(randomFetchTestMapper(), "field", 3.783147882954537E18, randomFetchTestFormat());
121119
}

server/src/test/java/org/elasticsearch/index/mapper/blockloader/TextFieldBlockLoaderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static Object expectedValue(Map<String, Object> fieldMapping, Object valu
4141

4242
var fields = (Map<String, Object>) fieldMapping.get("fields");
4343
if (fields != null) {
44-
var keywordMultiFieldMapping = (Map<String, Object>) fields.get("kwd");
44+
var keywordMultiFieldMapping = (Map<String, Object>) fields.get("subfield_keyword");
4545
Object normalizer = fields.get("normalizer");
4646
boolean docValues = hasDocValues(keywordMultiFieldMapping, true);
4747
boolean store = keywordMultiFieldMapping.getOrDefault("store", false).equals(true);

server/src/test/java/org/elasticsearch/index/mapper/blockloader/TextFieldWithParentBlockLoaderTests.java

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import org.elasticsearch.datageneration.FieldType;
1616
import org.elasticsearch.datageneration.MappingGenerator;
1717
import org.elasticsearch.datageneration.Template;
18-
import org.elasticsearch.datageneration.datasource.DataSourceHandler;
19-
import org.elasticsearch.datageneration.datasource.DataSourceRequest;
20-
import org.elasticsearch.datageneration.datasource.DataSourceResponse;
18+
import org.elasticsearch.datageneration.datasource.MultifieldAddonHandler;
2119
import org.elasticsearch.index.mapper.BlockLoaderTestCase;
2220
import org.elasticsearch.index.mapper.BlockLoaderTestRunner;
2321
import org.elasticsearch.index.mapper.MapperServiceTestCase;
@@ -49,51 +47,8 @@ public TextFieldWithParentBlockLoaderTests(BlockLoaderTestCase.Params params) {
4947
// of text multi field in a keyword field.
5048
public void testBlockLoaderOfParentField() throws IOException {
5149
var template = new Template(Map.of("parent", new Template.Leaf("parent", FieldType.KEYWORD.toString())));
52-
var specification = buildSpecification(List.of(new DataSourceHandler() {
53-
@Override
54-
public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceRequest.LeafMappingParametersGenerator request) {
55-
// This is a bit tricky meta-logic.
56-
// We want to customize mapping but to do this we need the mapping for the same field type
57-
// so we use name to untangle this.
58-
if (request.fieldName().equals("parent") == false) {
59-
return null;
60-
}
61-
62-
return new DataSourceResponse.LeafMappingParametersGenerator(() -> {
63-
var dataSource = request.dataSource();
64-
65-
var keywordParentMapping = dataSource.get(
66-
new DataSourceRequest.LeafMappingParametersGenerator(
67-
dataSource,
68-
"_field",
69-
FieldType.KEYWORD.toString(),
70-
request.eligibleCopyToFields(),
71-
request.dynamicMapping()
72-
)
73-
).mappingGenerator().get();
74-
75-
var textMultiFieldMapping = dataSource.get(
76-
new DataSourceRequest.LeafMappingParametersGenerator(
77-
dataSource,
78-
"_field",
79-
FieldType.TEXT.toString(),
80-
request.eligibleCopyToFields(),
81-
request.dynamicMapping()
82-
)
83-
).mappingGenerator().get();
84-
85-
// we don't need this here
86-
keywordParentMapping.remove("copy_to");
87-
88-
textMultiFieldMapping.put("type", "text");
89-
textMultiFieldMapping.remove("fields");
90-
91-
keywordParentMapping.put("fields", Map.of("mf", textMultiFieldMapping));
92-
93-
return keywordParentMapping;
94-
});
95-
}
96-
}));
50+
var specification = buildSpecification(List.of(new MultifieldAddonHandler(Map.of(FieldType.KEYWORD, List.of(FieldType.TEXT)), 1f)));
51+
9752
var mapping = new MappingGenerator(specification).generate(template);
9853
var fieldMapping = mapping.lookup().get("parent");
9954

@@ -106,7 +61,7 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques
10661
? createSytheticSourceMapperService(mappingXContent)
10762
: createMapperService(mappingXContent);
10863

109-
runner.runTest(mapperService, document, expected, "parent.mf");
64+
runner.runTest(mapperService, document, expected, "parent.subfield_text");
11065
}
11166

11267
@SuppressWarnings("unchecked")
@@ -123,7 +78,7 @@ private Object expected(Map<String, Object> fieldMapping, Object value, BlockLoa
12378
}
12479

12580
// we are using block loader of the text field itself
126-
var textFieldMapping = (Map<String, Object>) ((Map<String, Object>) fieldMapping.get("fields")).get("mf");
81+
var textFieldMapping = (Map<String, Object>) ((Map<String, Object>) fieldMapping.get("fields")).get("subfield_text");
12782
return TextFieldBlockLoaderTests.expectedValue(textFieldMapping, value, params, testContext);
12883
}
12984
}

test/framework/src/main/java/org/elasticsearch/datageneration/FieldType.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.elasticsearch.datageneration.fields.leaf.IpFieldDataGenerator;
2424
import org.elasticsearch.datageneration.fields.leaf.KeywordFieldDataGenerator;
2525
import org.elasticsearch.datageneration.fields.leaf.LongFieldDataGenerator;
26+
import org.elasticsearch.datageneration.fields.leaf.MatchOnlyTextFieldDataGenerator;
2627
import org.elasticsearch.datageneration.fields.leaf.ScaledFloatFieldDataGenerator;
2728
import org.elasticsearch.datageneration.fields.leaf.ShortFieldDataGenerator;
2829
import org.elasticsearch.datageneration.fields.leaf.TextFieldDataGenerator;
@@ -50,7 +51,8 @@ public enum FieldType {
5051
TEXT("text"),
5152
IP("ip"),
5253
CONSTANT_KEYWORD("constant_keyword"),
53-
WILDCARD("wildcard");
54+
WILDCARD("wildcard"),
55+
MATCH_ONLY_TEXT("match_only_text");
5456

5557
private final String name;
5658

@@ -78,6 +80,7 @@ public FieldDataGenerator generator(String fieldName, DataSource dataSource) {
7880
case IP -> new IpFieldDataGenerator(dataSource);
7981
case CONSTANT_KEYWORD -> new ConstantKeywordFieldDataGenerator();
8082
case WILDCARD -> new WildcardFieldDataGenerator(dataSource);
83+
case MATCH_ONLY_TEXT -> new MatchOnlyTextFieldDataGenerator(dataSource);
8184
};
8285
}
8386

@@ -101,6 +104,7 @@ public static FieldType tryParse(String name) {
101104
case "ip" -> FieldType.IP;
102105
case "constant_keyword" -> FieldType.CONSTANT_KEYWORD;
103106
case "wildcard" -> FieldType.WILDCARD;
107+
case "match_only_text" -> FieldType.MATCH_ONLY_TEXT;
104108
default -> null;
105109
};
106110
}

test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultMappingParametersHandler.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques
4444
case BOOLEAN -> booleanMapping();
4545
case DATE -> dateMapping();
4646
case GEO_POINT -> geoPointMapping();
47-
case TEXT -> textMapping(request);
47+
case TEXT -> textMapping();
4848
case IP -> ipMapping();
4949
case CONSTANT_KEYWORD -> constantKeywordMapping();
5050
case WILDCARD -> wildcardMapping();
51+
case MATCH_ONLY_TEXT -> matchOnlyTextMapping();
5152
});
5253
}
5354

@@ -96,8 +97,8 @@ private Supplier<Map<String, Object>> keywordMapping(DataSourceRequest.LeafMappi
9697
}
9798
}
9899

99-
if (ESTestCase.randomDouble() <= 0.2) {
100-
mapping.put("ignore_above", ESTestCase.randomIntBetween(1, 100));
100+
if (ESTestCase.randomDouble() <= 0.3) {
101+
mapping.put("ignore_above", ESTestCase.randomIntBetween(1, 50));
101102
}
102103
if (ESTestCase.randomDouble() <= 0.2) {
103104
mapping.put("null_value", ESTestCase.randomAlphaOfLengthBetween(0, 10));
@@ -196,21 +197,13 @@ private Supplier<Map<String, Object>> geoPointMapping() {
196197
};
197198
}
198199

199-
private Supplier<Map<String, Object>> textMapping(DataSourceRequest.LeafMappingParametersGenerator request) {
200+
private Supplier<Map<String, Object>> textMapping() {
200201
return () -> {
201202
var mapping = new HashMap<String, Object>();
202203

203204
mapping.put("store", ESTestCase.randomBoolean());
204205
mapping.put("index", ESTestCase.randomBoolean());
205206

206-
if (ESTestCase.randomDouble() <= 0.1) {
207-
var keywordMultiFieldMapping = keywordMapping(request).get();
208-
keywordMultiFieldMapping.put("type", "keyword");
209-
keywordMultiFieldMapping.remove("copy_to");
210-
211-
mapping.put("fields", Map.of("kwd", keywordMultiFieldMapping));
212-
}
213-
214207
return mapping;
215208
};
216209
}
@@ -247,8 +240,8 @@ private Supplier<Map<String, Object>> wildcardMapping() {
247240
return () -> {
248241
var mapping = new HashMap<String, Object>();
249242

250-
if (ESTestCase.randomDouble() <= 0.2) {
251-
mapping.put("ignore_above", ESTestCase.randomIntBetween(1, 100));
243+
if (ESTestCase.randomDouble() <= 0.3) {
244+
mapping.put("ignore_above", ESTestCase.randomIntBetween(1, 50));
252245
}
253246
if (ESTestCase.randomDouble() <= 0.2) {
254247
mapping.put("null_value", ESTestCase.randomAlphaOfLengthBetween(0, 10));
@@ -258,6 +251,10 @@ private Supplier<Map<String, Object>> wildcardMapping() {
258251
};
259252
}
260253

254+
private Supplier<Map<String, Object>> matchOnlyTextMapping() {
255+
return HashMap::new;
256+
}
257+
261258
public static HashMap<String, Object> commonMappingParameters() {
262259
var map = new HashMap<String, Object>();
263260
map.put("store", ESTestCase.randomBoolean());

test/framework/src/main/java/org/elasticsearch/datageneration/datasource/DefaultObjectGenerationHandler.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
import static org.elasticsearch.test.ESTestCase.randomRealisticUnicodeOfCodepointLengthBetween;
2121

2222
public class DefaultObjectGenerationHandler implements DataSourceHandler {
23+
24+
/**
25+
* Field names will not be generated which start with `_reserved_`. Handlers can safely
26+
* create field names starting with this prefix without the concern of randomly generated
27+
* fields having the same name.
28+
*/
29+
public static final String RESERVED_FIELD_NAME_PREFIX = "_reserved_";
30+
2331
@Override
2432
public DataSourceResponse.ChildFieldGenerator handle(DataSourceRequest.ChildFieldGenerator request) {
2533
return new DataSourceResponse.ChildFieldGenerator() {
@@ -57,6 +65,9 @@ public String generateFieldName() {
5765
if (fieldName.indexOf('.') != -1) {
5866
continue;
5967
}
68+
if (fieldName.startsWith(RESERVED_FIELD_NAME_PREFIX)) {
69+
continue;
70+
}
6071

6172
return fieldName;
6273
}

0 commit comments

Comments
 (0)