Fix effective_mappings field to remove _doc wrapper#6
Open
augment-app-staging[bot] wants to merge 1 commit intomainfrom
Open
Fix effective_mappings field to remove _doc wrapper#6augment-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 mappings API
(GetDataStreamMappingsAction) and update data stream mappings API
(UpdateDataStreamMappingsAction) was incorrectly returning a _doc
type wrapper that shouldn't be present according to the spec.
This change strips the _doc wrapper from effective_mappings before
returning it to the client, similar to how MappingMetadata.sourceAsMap()
handles the type wrapper.
Changes:
- Modified GetDataStreamMappingsAction.DataStreamMappingsResponse.toXContent
to strip _doc wrapper from effective_mappings
- Modified UpdateDataStreamMappingsAction.DataStreamMappingsResponse.toXContent
to strip _doc wrapper from effective_mappings
- Updated YAML rest tests to expect effective_mappings without _doc wrapper
The response now correctly returns:
{
"effective_mappings": {
"properties": { ... }
}
}
Instead of:
{
"effective_mappings": {
"_doc": {
"properties": { ... }
}
}
}
Related: https://augment-wic8570.slack.com/archives/C0AG2MXKEQJ/p1772239905420109
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 mappings API and update data stream mappings API to remove the incorrect_docwrapper.Problem
The
effective_mappingsfield returned by the get data stream mappings API (GetDataStreamMappingsAction) and update data stream mappings API (UpdateDataStreamMappingsAction) contained a_doctype wrapper that shouldn't be present according to the spec.Before:
{ "effective_mappings": { "_doc": { "properties": { ... } } } }After:
{ "effective_mappings": { "properties": { ... } } }Solution
Added logic to strip the
_docwrapper fromeffective_mappingsin thetoXContentmethods of both:GetDataStreamMappingsAction.DataStreamMappingsResponseUpdateDataStreamMappingsAction.DataStreamMappingsResponseThis follows the same pattern used in
MappingMetadata.sourceAsMap()which strips the type wrapper when converting mappings to a map.Changes
_docwrapper fromeffective_mappingsbefore serializing to XContent_docwrapper fromeffective_mappingsbefore serializing to XContenteffective_mappings.propertiesinstead ofeffective_mappings._doc.propertiesTesting
250_data_stream_mappings.ymlGetDataStreamMappingsActionTestsandUpdateDataStreamMappingsActionResponseTests) already expect the correct format without the_docwrapperRelated
Note: This PR was automatically created by Augment Agent. Please review carefully before merging.