Fix effective_mappings field to not include _doc wrapper#5
Open
augment-app-staging[bot] wants to merge 1 commit intomainfrom
Open
Fix effective_mappings field to not include _doc wrapper#5augment-app-staging[bot] wants to merge 1 commit intomainfrom
augment-app-staging[bot] wants to merge 1 commit intomainfrom
Conversation
The effective_mappings field in the get data stream API response
(GET /_data_stream/{name}/_mappings) and update data stream mappings
API response (PUT /_data_stream/{name}/_mappings) contained a _doc
wrapper at the top level which doesn't match the API specification.
This fix:
- Unwraps the _doc wrapper from effective_mappings in
GetDataStreamMappingsAction.DataStreamMappingsResponse.toXContent()
- Unwraps the _doc wrapper from effective_mappings in
UpdateDataStreamMappingsAction.DataStreamMappingsResponse.toXContent()
- Updates YAML rest tests to assert effective_mappings.properties
instead of effective_mappings._doc.properties
The fix checks if the uncompressed effective mappings map contains
the MapperService.SINGLE_MAPPING_NAME (_doc) key and extracts the
inner map if present, similar to the pattern used in
ComposableIndexTemplate.merge().
Related to: https://augment-wic8570.slack.com/archives/C0AG2MXKEQJ/p1772239116230249
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 the
effective_mappingsfield in the get data stream API response to not include a_docwrapper at the top level.Problem
The
effective_mappingsfield in the get data stream API response (GET /_data_stream/{name}/_mappings) and update data stream mappings API response (PUT /_data_stream/{name}/_mappings) contained a_docwrapper at the top level which doesn't match the API specification. The mapping structure should be returned directly without the_docwrapper.Changes
GetDataStreamMappingsAction.java: Updated
DataStreamMappingsResponse.toXContent()method to unwrap the_docwrapper fromeffective_mappingsby checking if the map containsMapperService.SINGLE_MAPPING_NAMEand extracting the inner map if present.UpdateDataStreamMappingsAction.java: Applied the same fix to
DataStreamMappingsResponse.toXContent()method.YAML tests: Updated test assertions in
250_data_stream_mappings.ymlto expecteffective_mappings.propertiesinstead ofeffective_mappings._doc.properties.Testing
GetDataStreamMappingsActionTestsandUpdateDataStreamMappingsActionResponseTestsmodules:data-streams:yamlRestTestRelated
Note: This PR was automatically created by Augment Agent and has not been assigned to anyone.