Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrik-es committed Dec 11, 2024
1 parent d370de6 commit 5e17f66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ public Settings getAdditionalIndexSettings(
) {
var logsdbSettings = logsdbIndexModeSettingsProvider.getLogsdbModeSetting(dataStreamName, settings);
if (logsdbSettings != Settings.EMPTY) {
settings = Settings.builder()
.put(logsdbSettings)
.put(settings)
.build();
settings = Settings.builder().put(logsdbSettings).put(settings).build();
}

// This index name is used when validating component and index templates, we should skip this check in that case.
Expand All @@ -90,16 +87,15 @@ public Settings getAdditionalIndexSettings(
indexName,
dataStreamName
);
if (syntheticSourceLicenseService.fallbackToStoredSource(isTemplateValidation, legacyLicensedUsageOfSyntheticSourceAllowed)) {
var builder = Settings.builder();
if (newIndexHasSyntheticSourceUsage(indexName, templateIndexMode, settings, combinedTemplateMappings)) {
LOGGER.debug("creation of index [{}] with synthetic source without it being allowed", indexName);
builder.put(SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.STORED.toString());
}
if (newIndexHasSyntheticSourceUsage(indexName, templateIndexMode, settings, combinedTemplateMappings)
&& syntheticSourceLicenseService.fallbackToStoredSource(isTemplateValidation, legacyLicensedUsageOfSyntheticSourceAllowed)) {
LOGGER.debug("creation of index [{}] with synthetic source without it being allowed", indexName);
var builder = Settings.builder()
.put(SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), SourceFieldMapper.Mode.STORED.toString());
if (settings.getAsBoolean(IndexSettings.LOGSDB_ROUTE_ON_SORT_FIELDS.getKey(), false)) {
builder.put(IndexSettings.LOGSDB_ROUTE_ON_SORT_FIELDS.getKey(), false);
}
return builder.keys().isEmpty() ? Settings.EMPTY : builder.build();
return builder.build();
} else if (templateIndexMode == IndexMode.LOGSDB
|| logsdbSettings != Settings.EMPTY
|| LogsdbIndexModeSettingsProvider.resolveIndexMode(settings.get(IndexSettings.MODE.getKey())) == IndexMode.LOGSDB) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ public void testLogsdbExplicitRoutingPathDoesNotMatchSortFields() throws Excepti
private Settings generateLogsdbSettings(Settings settings) throws IOException {
Metadata metadata = Metadata.EMPTY_METADATA;
var result = provider.getAdditionalIndexSettings(
null,
DataStream.getDefaultBackingIndexName(DATA_STREAM_NAME, 0),
DATA_STREAM_NAME,
IndexMode.LOGSDB,
metadata,
Expand Down

0 comments on commit 5e17f66

Please sign in to comment.