Strip _doc wrapper from effective_mappings in data stream API responses#1
Open
augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-basefrom
Open
Strip _doc wrapper from effective_mappings in data stream API responses#1augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-basefrom
augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-basefrom
Conversation
The effective_mappings field in the get data stream mappings API and update data stream mappings API responses was incorrectly including the _doc type wrapper at the top level. According to the spec, this wrapper should be stripped. This fix modifies the toXContent() methods in both GetDataStreamMappingsAction.DataStreamMappingsResponse and UpdateDataStreamMappingsAction.DataStreamMappingsResponse to check for and strip the _doc wrapper (MapperService.SINGLE_MAPPING_NAME) from the effective_mappings before rendering. The YAML tests have been updated to expect effective_mappings.properties instead of effective_mappings._doc.properties. Fixes: https://augment-wic8570.slack.com/archives/C0AG2MXKEQJ/p1772152737412069
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
This PR fixes an issue where the
effective_mappingsfield in the data stream API responses was incorrectly including the_doctype wrapper at the top level. According to the spec, this wrapper should be stripped.Problem
The
effective_mappingsfield in both the get data stream mappings API (GET /_data_stream/{name}/_mappings) and update data stream mappings API (PUT /_data_stream/{name}/_mappings) responses was returning mappings with a_docwrapper:{ "effective_mappings": { "_doc": { "properties": { ... } } } }But it should return:
{ "effective_mappings": { "properties": { ... } } }Solution
Modified the
toXContent()methods in:GetDataStreamMappingsAction.DataStreamMappingsResponseUpdateDataStreamMappingsAction.DataStreamMappingsResponseBoth methods now check for and strip the
_docwrapper (MapperService.SINGLE_MAPPING_NAME) from theeffective_mappingsbefore rendering the response.Changes
_docwrapper fromeffective_mappingsin the response_docwrapper fromeffective_mappingsin the responseeffective_mappings.propertiesinstead ofeffective_mappings._doc.propertiesTesting
_docwrapper)Related
Note: This PR was not assigned to anyone as it was triggered by an automated evaluation.