Strip _doc wrapper from effective_mapping field in API responses#3
Open
augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-branchfrom
Open
Strip _doc wrapper from effective_mapping field in API responses#3augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-branchfrom
augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-branchfrom
Conversation
The effective_mapping field in the get data stream API response and simulate ingest API response was incorrectly including a _doc wrapper at the top level. This fix strips the _doc type placeholder from the effective mapping output to match the API specification. Changes: - SimulateIndexResponse: Strip _doc wrapper in innerToXContent() - GetDataStreamMappingsAction: Strip _doc wrapper in DataStreamMappingsResponse.toXContent() - UpdateDataStreamMappingsAction: Strip _doc wrapper in DataStreamMappingsResponse.toXContent() - Updated YAML REST test to expect mappings without _doc wrapper The fix uses the same pattern as Template.reduceMapping() to check if the mapping contains only a single _doc key and unwraps it if present. Fixes issue where effective_mapping output had incorrect structure.
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.
Problem
The
effective_mappingfield in the get data stream API response and simulate ingest API response was incorrectly including a_docwrapper at the top level, but the spec says it should not have this wrapper. The_doctype placeholder needs to be stripped from the effective mapping output.Solution
This PR strips the
_docwrapper from effective mappings in API responses by applying the same pattern used inTemplate.reduceMapping().Changes Made:
_docwrapper ininnerToXContent()method_docwrapper inDataStreamMappingsResponse.toXContent()method_docwrapper inDataStreamMappingsResponse.toXContent()method_docwrapperImplementation Details:
The fix checks if the mapping contains only a single
_dockey and unwraps it if present:Testing:
SimulateIndexResponseTests,GetDataStreamMappingsActionTests,UpdateDataStreamMappingsActionResponseTests80_ingest_simulate.ymlRelated