Skip to content

Commit 1b2a428

Browse files
committed
Replace all string constants
1 parent 9300e9b commit 1b2a428

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ public Settings getAdditionalIndexSettings(
9797
) {
9898
Settings.Builder settingsBuilder = null;
9999
boolean isLogsDB = templateIndexMode == IndexMode.LOGSDB;
100-
boolean isTemplateValidation = "validate-index-name".equals(indexName);
100+
// This index name is used when validating component and index templates, we should skip this check in that case.
101+
// (See MetadataIndexTemplateService#validateIndexTemplateV2(...) method)
102+
boolean isTemplateValidation = MetadataIndexTemplateService.VALIDATE_INDEX_NAME.equals(indexName);
101103

102104
// Inject logsdb index mode, based on the logs pattern.
103105
if (isLogsdbEnabled
@@ -113,9 +115,6 @@ && matchesLogsPattern(dataStreamName)) {
113115

114116
// Inject stored source mode if synthetic source if not available per licence.
115117
if (mappingHints.hasSyntheticSourceUsage && supportFallbackToStoredSource.get()) {
116-
// This index name is used when validating component and index templates, we should skip this check in that case.
117-
// (See MetadataIndexTemplateService#validateIndexTemplateV2(...) method)
118-
boolean isTemplateValidation = MetadataIndexTemplateService.VALIDATE_INDEX_NAME.equals(indexName);
119118
boolean legacyLicensedUsageOfSyntheticSourceAllowed = isLegacyLicensedUsageOfSyntheticSourceAllowed(
120119
templateIndexMode,
121120
indexName,
@@ -212,7 +211,7 @@ MappingHints getMappingHints(
212211
Settings indexTemplateAndCreateRequestSettings,
213212
List<CompressedXContent> combinedTemplateMappings
214213
) {
215-
if ("validate-index-name".equals(indexName)) {
214+
if (MetadataIndexTemplateService.VALIDATE_INDEX_NAME.equals(indexName)) {
216215
// This index name is used when validating component and index templates, we should skip this check in that case.
217216
// (See MetadataIndexTemplateService#validateIndexTemplateV2(...) method)
218217
return MappingHints.EMPTY;

x-pack/plugin/logsdb/src/test/java/org/elasticsearch/xpack/logsdb/LogsdbIndexModeSettingsProviderTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.cluster.metadata.DataStreamTestHelper;
1414
import org.elasticsearch.cluster.metadata.IndexMetadata;
1515
import org.elasticsearch.cluster.metadata.Metadata;
16+
import org.elasticsearch.cluster.metadata.MetadataIndexTemplateService;
1617
import org.elasticsearch.cluster.metadata.Template;
1718
import org.elasticsearch.common.compress.CompressedXContent;
1819
import org.elasticsearch.common.settings.Settings;
@@ -482,7 +483,7 @@ public void testNewIndexHasSyntheticSourceUsage() throws IOException {
482483
}
483484

484485
public void testValidateIndexName() throws IOException {
485-
String indexName = "validate-index-name";
486+
String indexName = MetadataIndexTemplateService.VALIDATE_INDEX_NAME;
486487
String mapping = """
487488
{
488489
"_doc": {

0 commit comments

Comments
 (0)