Skip to content

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
eval-5dbcf369
Open

Strip _doc wrapper from effective_mappings in data stream API responses#1
augment-app-staging[bot] wants to merge 1 commit intoeval-tag-134005-basefrom
eval-5dbcf369

Conversation

@augment-app-staging
Copy link

Summary

This PR fixes an issue where the effective_mappings field in the data stream API responses was incorrectly including the _doc type wrapper at the top level. According to the spec, this wrapper should be stripped.

Problem

The effective_mappings field 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 _doc wrapper:

{
  "effective_mappings": {
    "_doc": {
      "properties": { ... }
    }
  }
}

But it should return:

{
  "effective_mappings": {
    "properties": { ... }
  }
}

Solution

Modified the toXContent() methods in:

  • GetDataStreamMappingsAction.DataStreamMappingsResponse
  • UpdateDataStreamMappingsAction.DataStreamMappingsResponse

Both methods now check for and strip the _doc wrapper (MapperService.SINGLE_MAPPING_NAME) from the effective_mappings before rendering the response.

Changes

  1. GetDataStreamMappingsAction.java: Added logic to strip _doc wrapper from effective_mappings in the response
  2. UpdateDataStreamMappingsAction.java: Added logic to strip _doc wrapper from effective_mappings in the response
  3. 250_data_stream_mappings.yml: Updated YAML tests to expect effective_mappings.properties instead of effective_mappings._doc.properties

Testing

  • Updated YAML REST tests to verify the correct format
  • Existing unit tests already expected the correct format (without _doc wrapper)

Related

Note: This PR was not assigned to anyone as it was triggered by an automated evaluation.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants