Skip to content

Commit 56fea57

Browse files
Rename patterned_text to pattern_text (#134834)
Rename all usage of patterned_text to pattern_text. This includes all classes/files that are named PatternedText*. It also updates the feature flag to pattern_text. Only the NodeFeature mapper.patterned_text and the setting index.mapping.patterned_text.disable_templating is not changed.
1 parent 8d2c4c3 commit 56fea57

37 files changed

+329
-334
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class MapperFeatures implements FeatureSpecification {
4646
static final NodeFeature IVF_NESTED_SUPPORT = new NodeFeature("mapper.ivf_nested_support");
4747
static final NodeFeature BBQ_DISK_SUPPORT = new NodeFeature("mapper.bbq_disk_support");
4848
static final NodeFeature SEARCH_LOAD_PER_SHARD = new NodeFeature("mapper.search_load_per_shard");
49-
static final NodeFeature PATTERNED_TEXT = new NodeFeature("mapper.patterned_text");
49+
static final NodeFeature PATTERN_TEXT = new NodeFeature("mapper.patterned_text");
5050
static final NodeFeature IGNORED_SOURCE_FIELDS_PER_ENTRY = new NodeFeature("mapper.ignored_source_fields_per_entry");
5151
public static final NodeFeature MULTI_FIELD_UNICODE_OPTIMISATION_FIX = new NodeFeature("mapper.multi_field.unicode_optimisation_fix");
5252

@@ -82,7 +82,7 @@ public Set<NodeFeature> getTestFeatures() {
8282
BBQ_DISK_SUPPORT,
8383
SEARCH_LOAD_PER_SHARD,
8484
SPARSE_VECTOR_INDEX_OPTIONS_FEATURE,
85-
PATTERNED_TEXT,
85+
PATTERN_TEXT,
8686
IGNORED_SOURCE_FIELDS_PER_ENTRY,
8787
MULTI_FIELD_UNICODE_OPTIMISATION_FIX
8888
);

server/src/main/java/org/elasticsearch/search/fetch/subphase/highlight/HighlightPhase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private FieldContext contextBuilders(
125125
if (fieldType.typeName().equals(TextFieldMapper.CONTENT_TYPE) == false
126126
&& fieldType.typeName().equals(KeywordFieldMapper.CONTENT_TYPE) == false
127127
&& fieldType.typeName().equals("match_only_text") == false
128-
&& fieldType.typeName().equals("patterned_text") == false) {
128+
&& fieldType.typeName().equals("pattern_text") == false) {
129129
continue;
130130
}
131131
if (highlighter.canHighlight(fieldType) == false) {

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/FeatureFlag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public enum FeatureFlag {
2121
DOC_VALUES_SKIPPER("es.doc_values_skipper_feature_flag_enabled=true", Version.fromString("8.18.1"), null),
2222
IVF_FORMAT("es.ivf_format_feature_flag_enabled=true", Version.fromString("9.1.0"), null),
2323
LOGS_STREAM("es.logs_stream_feature_flag_enabled=true", Version.fromString("9.1.0"), null),
24-
PATTERNED_TEXT("es.patterned_text_feature_flag_enabled=true", Version.fromString("9.1.0"), null),
24+
PATTERN_TEXT("es.patterned_text_feature_flag_enabled=true", Version.fromString("9.1.0"), null),
2525
SYNTHETIC_VECTORS("es.mapping_synthetic_vectors=true", Version.fromString("9.2.0"), null),
2626
RERANK_SNIPPETS("es.text_similarity_reranker_snippets=true", Version.fromString("9.2.0"), null);
2727

x-pack/plugin/logsdb/src/javaRestTest/java/org/elasticsearch/xpack/logsdb/LogsdbRestIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void testFeatureUsageWithLogsdbIndex() throws IOException {
8383
if (feature.get("family") != null) {
8484
assertThat(
8585
feature.get("name"),
86-
anyOf(equalTo("synthetic-source"), equalTo("logsdb-routing-on-sort-fields"), equalTo("patterned-text-templating"))
86+
anyOf(equalTo("synthetic-source"), equalTo("logsdb-routing-on-sort-fields"), equalTo("pattern-text-templating"))
8787
);
8888
assertThat(feature.get("license_level"), equalTo("enterprise"));
8989
found = true;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.logsdb.patternedtext;
8+
package org.elasticsearch.xpack.logsdb.patterntext;
99

1010
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1111

@@ -32,14 +32,14 @@
3232
import static org.hamcrest.Matchers.equalTo;
3333
import static org.hamcrest.Matchers.is;
3434

35-
public class PatternedTextBasicRestIT extends ESRestTestCase {
35+
public class PatternTextBasicRestIT extends ESRestTestCase {
3636

3737
@ClassRule
3838
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
3939
.distribution(DistributionType.DEFAULT)
4040
.setting("xpack.license.self_generated.type", "trial")
4141
.setting("xpack.security.enabled", "false")
42-
.feature(FeatureFlag.PATTERNED_TEXT)
42+
.feature(FeatureFlag.PATTERN_TEXT)
4343
.build();
4444

4545
@Override
@@ -54,7 +54,7 @@ public static List<Object[]> args() {
5454

5555
private final boolean disableTemplating;
5656

57-
public PatternedTextBasicRestIT(boolean disableTemplating) {
57+
public PatternTextBasicRestIT(boolean disableTemplating) {
5858
this.disableTemplating = disableTemplating;
5959
}
6060

@@ -76,7 +76,7 @@ public void testBulkInsertThenMatchAllSource() throws IOException {
7676
"type": "date"
7777
},
7878
"message": {
79-
"type": "patterned_text",
79+
"type": "pattern_text",
8080
"disable_templating": %disable_templating%
8181
}
8282
}
@@ -91,7 +91,7 @@ public void testBulkInsertThenMatchAllSource() throws IOException {
9191
indexDocs(indexName, messages);
9292

9393
var actualMapping = getIndexMappingAsMap(indexName);
94-
assertThat("patterned_text", equalTo(ObjectPath.evaluate(actualMapping, "properties.message.type")));
94+
assertThat("pattern_text", equalTo(ObjectPath.evaluate(actualMapping, "properties.message.type")));
9595

9696
Request searchRequest = new Request("GET", "/" + indexName + "/_search");
9797
searchRequest.setJsonEntity("""
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.logsdb.patternedtext;
8+
package org.elasticsearch.xpack.logsdb.patterntext;
99

1010
import org.elasticsearch.Build;
1111
import org.elasticsearch.xpack.logsdb.DataStreamLicenseChangeTestCase;
@@ -18,20 +18,20 @@
1818
import static org.hamcrest.Matchers.hasKey;
1919
import static org.hamcrest.Matchers.not;
2020

21-
public class PatternedTextLicenseDowngradeIT extends DataStreamLicenseChangeTestCase {
21+
public class PatternTextLicenseDowngradeIT extends DataStreamLicenseChangeTestCase {
2222
@Before
2323
public void checkClusterFeature() {
24-
assumeTrue("[patterned_text] must be available", clusterHasFeature("mapper.patterned_text"));
25-
assumeTrue("[patterned_text] is only available in snapshot builds", Build.current().isSnapshot());
24+
assumeTrue("[pattern_text] must be available", clusterHasFeature("mapper.patterned_text"));
25+
assumeTrue("[pattern_text] is only available in snapshot builds", Build.current().isSnapshot());
2626
}
2727

28-
private static final String patternedTextMapping = """
28+
private static final String patternTextMapping = """
2929
{
3030
"template": {
3131
"mappings": {
3232
"properties": {
33-
"patterned_field": {
34-
"type": "patterned_text"
33+
"pattern_field": {
34+
"type": "pattern_text"
3535
}
3636
}
3737
}
@@ -40,20 +40,20 @@ public void checkClusterFeature() {
4040

4141
@SuppressWarnings("unchecked")
4242
public void testLicenseDowngrade() throws IOException {
43-
final String dataStreamName = "logs-test-patterned-text";
43+
final String dataStreamName = "logs-test-pattern-text";
4444

4545
startTrial();
46-
assertOK(putComponentTemplate(client(), "logs@custom", patternedTextMapping));
46+
assertOK(putComponentTemplate(client(), "logs@custom", patternTextMapping));
4747
assertOK(createDataStream(client(), dataStreamName));
4848

4949
String backingIndex0 = getDataStreamBackingIndex(client(), dataStreamName, 0);
5050
{
5151
assertEquals("false", getSetting(client(), backingIndex0, "index.mapping.patterned_text.disable_templating"));
5252
Map<String, Object> mapping = getMapping(client(), backingIndex0);
53-
Map<String, Object> patternedFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
54-
"patterned_field"
53+
Map<String, Object> patternFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
54+
"pattern_field"
5555
);
56-
assertThat(patternedFieldMapping, not(hasKey("disable_templating")));
56+
assertThat(patternFieldMapping, not(hasKey("disable_templating")));
5757
}
5858

5959
startBasic();
@@ -62,20 +62,20 @@ public void testLicenseDowngrade() throws IOException {
6262
{
6363
assertEquals("false", getSetting(client(), backingIndex0, "index.mapping.patterned_text.disable_templating"));
6464
Map<String, Object> mapping = getMapping(client(), backingIndex0);
65-
Map<String, Object> patternedFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
66-
"patterned_field"
65+
Map<String, Object> patternFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
66+
"pattern_field"
6767
);
68-
assertThat(patternedFieldMapping, not(hasKey("disable_templating")));
68+
assertThat(patternFieldMapping, not(hasKey("disable_templating")));
6969
}
7070

7171
String backingIndex1 = getDataStreamBackingIndex(client(), dataStreamName, 1);
7272
{
7373
assertEquals("true", getSetting(client(), backingIndex1, "index.mapping.patterned_text.disable_templating"));
7474
Map<String, Object> mapping = getMapping(client(), backingIndex1);
75-
Map<String, Object> patternedFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
76-
"patterned_field"
75+
Map<String, Object> patternFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
76+
"pattern_field"
7777
);
78-
assertThat(patternedFieldMapping, hasEntry("disable_templating", true));
78+
assertThat(patternFieldMapping, hasEntry("disable_templating", true));
7979
}
8080

8181
}
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.logsdb.patternedtext;
8+
package org.elasticsearch.xpack.logsdb.patterntext;
99

1010
import org.elasticsearch.Build;
1111
import org.elasticsearch.xpack.logsdb.DataStreamLicenseChangeTestCase;
@@ -18,20 +18,20 @@
1818
import static org.hamcrest.Matchers.hasKey;
1919
import static org.hamcrest.Matchers.not;
2020

21-
public class PatternedTextLicenseUpgradeIT extends DataStreamLicenseChangeTestCase {
21+
public class PatternTextLicenseUpgradeIT extends DataStreamLicenseChangeTestCase {
2222
@Before
2323
public void checkClusterFeature() {
24-
assumeTrue("[patterned_text] must be available", clusterHasFeature("mapper.patterned_text"));
25-
assumeTrue("[patterned_text] is only available in snapshot builds", Build.current().isSnapshot());
24+
assumeTrue("[pattern_text] must be available", clusterHasFeature("mapper.patterned_text"));
25+
assumeTrue("[pattern_text] is only available in snapshot builds", Build.current().isSnapshot());
2626
}
2727

28-
private static final String patternedTextMapping = """
28+
private static final String patternTextMapping = """
2929
{
3030
"template": {
3131
"mappings": {
3232
"properties": {
33-
"patterned_field": {
34-
"type": "patterned_text"
33+
"pattern_field": {
34+
"type": "pattern_text"
3535
}
3636
}
3737
}
@@ -40,19 +40,19 @@ public void checkClusterFeature() {
4040

4141
@SuppressWarnings("unchecked")
4242
public void testLicenseUpgrade() throws IOException {
43-
final String dataStreamName = "logs-test-patterned-text";
43+
final String dataStreamName = "logs-test-pattern-text";
4444

45-
assertOK(putComponentTemplate(client(), "logs@custom", patternedTextMapping));
45+
assertOK(putComponentTemplate(client(), "logs@custom", patternTextMapping));
4646
assertOK(createDataStream(client(), dataStreamName));
4747

4848
String backingIndex0 = getDataStreamBackingIndex(client(), dataStreamName, 0);
4949
{
5050
assertEquals("true", getSetting(client(), backingIndex0, "index.mapping.patterned_text.disable_templating"));
5151
Map<String, Object> mapping = getMapping(client(), backingIndex0);
52-
Map<String, Object> patternedFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
53-
"patterned_field"
52+
Map<String, Object> patternFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
53+
"pattern_field"
5454
);
55-
assertThat(patternedFieldMapping, hasEntry("disable_templating", true));
55+
assertThat(patternFieldMapping, hasEntry("disable_templating", true));
5656
}
5757

5858
startTrial();
@@ -61,20 +61,20 @@ public void testLicenseUpgrade() throws IOException {
6161
{
6262
assertEquals("true", getSetting(client(), backingIndex0, "index.mapping.patterned_text.disable_templating"));
6363
Map<String, Object> mapping = getMapping(client(), backingIndex0);
64-
Map<String, Object> patternedFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
65-
"patterned_field"
64+
Map<String, Object> patternFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
65+
"pattern_field"
6666
);
67-
assertThat(patternedFieldMapping, hasEntry("disable_templating", true));
67+
assertThat(patternFieldMapping, hasEntry("disable_templating", true));
6868
}
6969

7070
String backingIndex1 = getDataStreamBackingIndex(client(), dataStreamName, 1);
7171
{
7272
assertEquals("false", getSetting(client(), backingIndex1, "index.mapping.patterned_text.disable_templating"));
7373
Map<String, Object> mapping = getMapping(client(), backingIndex1);
74-
Map<String, Object> patternedFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
75-
"patterned_field"
74+
Map<String, Object> patternFieldMapping = (Map<String, Object>) ((Map<String, Object>) mapping.get("properties")).get(
75+
"pattern_field"
7676
);
77-
assertThat(patternedFieldMapping, not(hasKey("disable_templating")));
77+
assertThat(patternFieldMapping, not(hasKey("disable_templating")));
7878
}
7979

8080
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import org.elasticsearch.xpack.core.XPackPlugin;
2222
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
2323
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
24-
import org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextFieldMapper;
25-
import org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextFieldType;
24+
import org.elasticsearch.xpack.logsdb.patterntext.PatternTextFieldMapper;
25+
import org.elasticsearch.xpack.logsdb.patterntext.PatternTextFieldType;
2626

2727
import java.util.ArrayList;
2828
import java.util.Collection;
@@ -95,8 +95,8 @@ public Collection<IndexSettingProvider> getAdditionalIndexSettingProviders(Index
9595
@Override
9696
public List<Setting<?>> getSettings() {
9797
List<Setting<?>> settings = new ArrayList<>(List.of(FALLBACK_SETTING, CLUSTER_LOGSDB_ENABLED, LOGSDB_PRIOR_LOGS_USAGE));
98-
if (PatternedTextFieldMapper.PATTERNED_TEXT_MAPPER.isEnabled()) {
99-
settings.add(PatternedTextFieldMapper.DISABLE_TEMPLATING_SETTING);
98+
if (PatternTextFieldMapper.PATTERN_TEXT_MAPPER.isEnabled()) {
99+
settings.add(PatternTextFieldMapper.DISABLE_TEMPLATING_SETTING);
100100
}
101101
return Collections.unmodifiableList(settings);
102102
}
@@ -111,8 +111,8 @@ public List<ActionPlugin.ActionHandler> getActions() {
111111

112112
@Override
113113
public Map<String, Mapper.TypeParser> getMappers() {
114-
if (PatternedTextFieldMapper.PATTERNED_TEXT_MAPPER.isEnabled()) {
115-
return singletonMap(PatternedTextFieldType.CONTENT_TYPE, PatternedTextFieldMapper.PARSER);
114+
if (PatternTextFieldMapper.PATTERN_TEXT_MAPPER.isEnabled()) {
115+
return singletonMap(PatternTextFieldType.CONTENT_TYPE, PatternTextFieldMapper.PARSER);
116116
} else {
117117
return Map.of();
118118
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.elasticsearch.index.mapper.ObjectMapper;
3535
import org.elasticsearch.index.mapper.SourceFieldMapper;
3636
import org.elasticsearch.xcontent.XContentType;
37-
import org.elasticsearch.xpack.logsdb.patternedtext.PatternedTextFieldMapper;
37+
import org.elasticsearch.xpack.logsdb.patterntext.PatternTextFieldMapper;
3838

3939
import java.io.IOException;
4040
import java.time.Instant;
@@ -194,9 +194,9 @@ && matchesLogsPattern(dataStreamName)) {
194194
}
195195
}
196196

197-
if (PatternedTextFieldMapper.PATTERNED_TEXT_MAPPER.isEnabled()
198-
&& licenseService.allowPatternedTextTemplating(isTemplateValidation) == false) {
199-
additionalSettings.put(PatternedTextFieldMapper.DISABLE_TEMPLATING_SETTING.getKey(), true);
197+
if (PatternTextFieldMapper.PATTERN_TEXT_MAPPER.isEnabled()
198+
&& licenseService.allowPatternTextTemplating(isTemplateValidation) == false) {
199+
additionalSettings.put(PatternTextFieldMapper.DISABLE_TEMPLATING_SETTING.getKey(), true);
200200
}
201201
}
202202

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ final class LogsdbLicenseService {
5959
License.OperationMode.ENTERPRISE
6060
);
6161

62-
static final LicensedFeature.Momentary PATTERNED_TEXT_TEMPLATING_FEATURE = LicensedFeature.momentary(
62+
static final LicensedFeature.Momentary PATTERN_TEXT_TEMPLATING_FEATURE = LicensedFeature.momentary(
6363
MAPPINGS_FEATURE_FAMILY,
64-
"patterned-text-templating",
64+
"pattern-text-templating",
6565
License.OperationMode.ENTERPRISE
6666
);
6767

@@ -110,10 +110,10 @@ && checkFeature(SYNTHETIC_SOURCE_FEATURE_LEGACY, licenseStateSnapshot, isTemplat
110110
}
111111

112112
/**
113-
* @return whether patterned_text fields should allow templating.
113+
* @return whether pattern_text fields should allow templating.
114114
*/
115-
public boolean allowPatternedTextTemplating(boolean isTemplateValidation) {
116-
return checkFeature(PATTERNED_TEXT_TEMPLATING_FEATURE, licenseState.copyCurrentLicenseState(), isTemplateValidation);
115+
public boolean allowPatternTextTemplating(boolean isTemplateValidation) {
116+
return checkFeature(PATTERN_TEXT_TEMPLATING_FEATURE, licenseState.copyCurrentLicenseState(), isTemplateValidation);
117117
}
118118

119119
/**

0 commit comments

Comments
 (0)