From 9631133d15ad1a1b6703467cd18626abe8ad3820 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 19 Dec 2024 14:09:51 +0100 Subject: [PATCH] iter --- .../org/elasticsearch/index/mapper/SourceFieldMapper.java | 6 +++++- .../xpack/logsdb/LogsdbIndexModeSettingsProviderTests.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java index 4b89acafa77ce..8cdcad7b7bf5e 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java @@ -279,7 +279,11 @@ private Mode resolveSourceMode() { } if (sourceModeIsNoop) { - return indexMode.defaultSourceMode(); + if (indexMode == null || indexMode == IndexMode.STANDARD) { + return null; + } else { + return indexMode.defaultSourceMode(); + } } // If `_source.mode` is not set we need to apply a default according to index mode. diff --git a/x-pack/plugin/logsdb/src/test/java/org/elasticsearch/xpack/logsdb/LogsdbIndexModeSettingsProviderTests.java b/x-pack/plugin/logsdb/src/test/java/org/elasticsearch/xpack/logsdb/LogsdbIndexModeSettingsProviderTests.java index de4f0960f50e7..ba3eb389dd55f 100644 --- a/x-pack/plugin/logsdb/src/test/java/org/elasticsearch/xpack/logsdb/LogsdbIndexModeSettingsProviderTests.java +++ b/x-pack/plugin/logsdb/src/test/java/org/elasticsearch/xpack/logsdb/LogsdbIndexModeSettingsProviderTests.java @@ -405,7 +405,7 @@ public void testNewIndexHasSyntheticSourceUsage() throws IOException { } """; boolean result = provider.newIndexHasSyntheticSourceUsage(indexName, null, settings, List.of(new CompressedXContent(mapping))); - assertTrue(result); + assertFalse("_source.mode is a noop", result); assertThat(newMapperServiceCounter.get(), equalTo(1)); assertWarnings(SourceFieldMapper.DEPRECATION_WARNING); }