-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate _source.mode in mappings #116689
Conversation
c8f9a22
to
63cfc41
Compare
496f8d8
to
d2b8d68
Compare
d2b8d68
to
1331464
Compare
Hi @dnhatn, I've created a changelog YAML for you. Note that since this PR is labelled |
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Nhat, I left questions are the deprecation logic in MetadataCreateIndexService
.
I wonder whether the following is perhaps a better mechanism to emit depreciation warning in case _source.mode is used:
Subject: [PATCH] Adjust SyntheticSourceLicenseService
Allow gold and platinum license to use synthetic source for a limited time.
If the start time of a license if before a cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.
---
Index: server/src/main/java/org/elasticsearch/index/mapper/MappingParser.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MappingParser.java b/server/src/main/java/org/elasticsearch/index/mapper/MappingParser.java
--- a/server/src/main/java/org/elasticsearch/index/mapper/MappingParser.java (revision bd091d3d96b33adb4121f980dc4f9f7a2a87b043)
+++ b/server/src/main/java/org/elasticsearch/index/mapper/MappingParser.java (date 1731573325979)
@@ -10,6 +10,8 @@
package org.elasticsearch.index.mapper;
import org.elasticsearch.common.compress.CompressedXContent;
+import org.elasticsearch.common.logging.DeprecationCategory;
+import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.index.mapper.MapperService.MergeReason;
@@ -27,6 +29,9 @@
* Parser for {@link Mapping} provided in {@link CompressedXContent} format
*/
public final class MappingParser {
+
+ private static final DeprecationLogger DEPRECATION_LOGGER = DeprecationLogger.getLogger(MappingParser.class);
+
private final Supplier<MappingParserContext> mappingParserContextSupplier;
private final Supplier<Map<Class<? extends MetadataFieldMapper>, MetadataFieldMapper>> metadataMappersSupplier;
private final Map<String, MetadataFieldMapper.TypeParser> metadataMapperParsers;
@@ -144,6 +149,14 @@
}
@SuppressWarnings("unchecked")
Map<String, Object> fieldNodeMap = (Map<String, Object>) fieldNode;
+
+ // iirc after parsing fieldNodeMap, keys are removed
+ if (reason == MergeReason.MAPPING_UPDATE && SourceFieldMapper.CONTENT_TYPE.equals(fieldName)) {
+ if (fieldNodeMap.containsKey("mode")) {
+ DEPRECATION_LOGGER.critical(DeprecationCategory.MAPPINGS, "mapping_source_mode", SourceFieldMapper.DEPRECATION_WARNING);
+ }
+ }
+
MetadataFieldMapper metadataFieldMapper = typeParser.parse(fieldName, fieldNodeMap, mappingParserContext).build();
metadataMappers.put(metadataFieldMapper.getClass(), metadataFieldMapper);
assert fieldNodeMap.isEmpty();
I think this also returns warning when mapping gets updated, maybe that isn't too bad? But this should only return a warning when _source.mode attribute is really used.
final IndexSettings indexSettings = mapperService.getIndexSettings(); | ||
if (indexSettings != null | ||
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.DEPRECATE_SOURCE_MODE_MAPPER) | ||
&& SourceFieldMapper.isSynthetic(indexSettings) == false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to check whether index.mapping.source.mode
index setting has not be defined here? Other we only check whether this setting has been set to synthetic
?
&& indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.DEPRECATE_SOURCE_MODE_MAPPER) | ||
&& SourceFieldMapper.isSynthetic(indexSettings) == false | ||
&& mapperService.documentMapper() != null | ||
&& mapperService.documentMapper().sourceMapper().isSynthetic()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we check whether index.mapping.source.mode
has not be defined, then I think mapperService.documentMapper().sourceMapper().isSynthetic()
can return true if index.mode=logsdb|time_series and no _source.mode has been defined?
This change deprecates _source.mode in mappings, replacing it with the index.mapping.source.mode index setting.
This change deprecates _source.mode in mappings, replacing it with the index.mapping.source.mode index setting.
This reverts commit 0d7b90e.
Re-introduce elastic#116689 using cluster features
This change deprecates _source.mode in mappings, replacing it with the index.mapping.source.mode index setting.
Re-introduce elastic#116689
Re-introduce elastic#116689
Re-introduce elastic#116689
Backport of elastic#116689 to 8.18
Backport of elastic#116689 to 8.18
This change deprecates _source.mode in mappings, replacing it with the index.mapping.source.mode index setting.
This change deprecates _source.mode in mappings, replacing it with the
index.mapping.source.mode
index setting.