Skip to content

Commit 2c2e5b2

Browse files
committed
Cleaned up
1 parent beee8c4 commit 2c2e5b2

File tree

8 files changed

+32
-17
lines changed

8 files changed

+32
-17
lines changed

modules/mapper-extras/src/main/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static class Defaults {
100100

101101
}
102102

103-
public static class Builder extends BuilderWithSyntheticSourceSupport {
103+
public static class Builder extends BuilderWithSyntheticSourceContext {
104104

105105
private final Parameter<Map<String, String>> meta = Parameter.metaParam();
106106

muted-tests.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,18 @@ tests:
555555
- class: org.elasticsearch.discovery.DiscoveryDisruptionIT
556556
method: testElectMasterWithLatestVersion
557557
issue: https://github.com/elastic/elasticsearch/issues/134748
558+
- class: org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextIntegrationTests
559+
method: testLargeValueIsStored
560+
issue: https://github.com/elastic/elasticsearch/issues/134760
561+
- class: org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextIntegrationTests
562+
method: testSourceMatchAllManyValues
563+
issue: https://github.com/elastic/elasticsearch/issues/134761
564+
- class: org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextIntegrationTests
565+
method: testQueryResultsSameAsMatchOnlyText
566+
issue: https://github.com/elastic/elasticsearch/issues/134762
567+
- class: org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextIntegrationTests
568+
method: testSmallValueNotStored
569+
issue: https://github.com/elastic/elasticsearch/issues/134763
558570

559571
# Examples:
560572
#

plugins/mapper-annotated-text/src/main/java/org/elasticsearch/index/mapper/annotatedtext/AnnotatedTextFieldMapper.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private static NamedAnalyzer wrapAnalyzer(NamedAnalyzer in) {
8181
);
8282
}
8383

84-
public static class Builder extends BuilderWithSyntheticSourceSupport {
84+
public static class Builder extends BuilderWithSyntheticSourceContext {
8585

8686
final Parameter<SimilarityProvider> similarity = TextParams.similarity(m -> builder(m).similarity.getValue());
8787
final Parameter<String> indexOptions = TextParams.textIndexOptions(m -> builder(m).indexOptions.getValue());
@@ -107,14 +107,12 @@ public Builder(
107107
m -> builder(m).analyzers.positionIncrementGap.getValue(),
108108
indexCreatedVersion
109109
);
110-
this.store = Parameter.storeParam(m -> builder(m).store.getValue(), this::storeDefault);
111-
}
112-
113-
private boolean storeDefault() {
114-
if (TextFieldMapper.keywordMultiFieldsNotStoredWhenIgnoredIndexVersionCheck(indexCreatedVersion())) {
115-
return false;
116-
}
117-
return isSyntheticSourceEnabled() && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false;
110+
this.store = Parameter.storeParam(m -> builder(m).store.getValue(), () -> {
111+
if (TextFieldMapper.keywordMultiFieldsNotStoredWhenIgnoredIndexVersionCheck(indexCreatedVersion())) {
112+
return false;
113+
}
114+
return isSyntheticSourceEnabled() && multiFieldsBuilder.hasSyntheticSourceCompatibleKeywordField() == false;
115+
});
118116
}
119117

120118
@Override

server/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,13 +1663,13 @@ protected boolean inheritDimensionParameterFromParentObject(MapperBuilderContext
16631663
/**
16641664
* Creates mappers for fields that require additional context for supporting synthetic source.
16651665
*/
1666-
public abstract static class BuilderWithSyntheticSourceSupport extends Builder {
1666+
public abstract static class BuilderWithSyntheticSourceContext extends Builder {
16671667

16681668
private final IndexVersion indexCreatedVersion;
16691669
private final boolean isSyntheticSourceEnabled;
16701670
private final boolean isWithinMultiField;
16711671

1672-
protected BuilderWithSyntheticSourceSupport(
1672+
protected BuilderWithSyntheticSourceContext(
16731673
String name,
16741674
IndexVersion indexCreatedVersion,
16751675
boolean isSyntheticSourceEnabled,

server/src/main/java/org/elasticsearch/index/mapper/TextFamilyFieldType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
import java.util.Map;
1313

14+
/**
15+
* This is a quality of life class that adds synthetic source context for text fields that need it.
16+
*/
1417
public abstract class TextFamilyFieldType extends StringFieldType {
1518

1619
private final boolean isSyntheticSourceEnabled;

server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private static FielddataFrequencyFilter parseFrequencyFilter(String name, Mappin
237237
return new FielddataFrequencyFilter(minFrequency, maxFrequency, minSegmentSize);
238238
}
239239

240-
public static class Builder extends BuilderWithSyntheticSourceSupport {
240+
public static class Builder extends BuilderWithSyntheticSourceContext {
241241

242242
private final Parameter<Boolean> store;
243243
private final Parameter<Boolean> norms;

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/*
22
* 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; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
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".
68
*/
79

810
package org.elasticsearch.upgrades;

x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/patternedtext/PatternedTextFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static class Defaults {
7373
}
7474
}
7575

76-
public static class Builder extends BuilderWithSyntheticSourceSupport {
76+
public static class Builder extends BuilderWithSyntheticSourceContext {
7777

7878
private final IndexSettings indexSettings;
7979
private final Parameter<Map<String, String>> meta = Parameter.metaParam();

0 commit comments

Comments
 (0)