Fix effective_mapping field to not include _doc wrapper at top level#9
Open
augment-app-staging[bot] wants to merge 1 commit intomainfrom
Open
Fix effective_mapping field to not include _doc wrapper at top level#9augment-app-staging[bot] wants to merge 1 commit intomainfrom
augment-app-staging[bot] wants to merge 1 commit intomainfrom
Conversation
Strip the _doc wrapper from effective_mappings in toXContent() methods of GetDataStreamMappingsAction.DataStreamMappingsResponse and UpdateDataStreamMappingsAction.DataStreamMappingsResponse, matching the pattern already used in DataStream.getEffectiveMappings().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the
effective_mappingsfield in the get/update data stream mappings API responses to not include the_docwrapper at the top level.Problem
The
toXContent()methods inGetDataStreamMappingsAction.DataStreamMappingsResponseandUpdateDataStreamMappingsAction.DataStreamMappingsResponseserializeeffective_mappingswithout stripping the_docwrapper. This is inconsistent withDataStream.getEffectiveMappings()which already strips it.Fix
After converting
effectiveMappingsfromCompressedXContentto a map, check if the map contains the_dockey (MapperService.SINGLE_MAPPING_NAME). If it does, unwrap it by using the value under that key instead. This matches the existing pattern inDataStream.getEffectiveMappings().Files changed:
server/src/main/java/org/elasticsearch/action/datastreams/GetDataStreamMappingsAction.javaserver/src/main/java/org/elasticsearch/action/datastreams/UpdateDataStreamMappingsAction.javaTriggered by: Slack-Bot-Evals
Slack thread: https://augment-wic8570.slack.com/archives/C0AG2MXKEQJ/p1772572830593139