Skip to content

Fix effective_mappings field to not include _doc wrapper#5

Open
augment-app-staging[bot] wants to merge 1 commit intomainfrom
eval-0b2f6307
Open

Fix effective_mappings field to not include _doc wrapper#5
augment-app-staging[bot] wants to merge 1 commit intomainfrom
eval-0b2f6307

Conversation

@augment-app-staging
Copy link

Summary

This PR fixes the effective_mappings field in the get data stream API response to not include a _doc wrapper at the top level.

Problem

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. The mapping structure should be returned directly without the _doc wrapper.

Changes

  1. GetDataStreamMappingsAction.java: Updated DataStreamMappingsResponse.toXContent() method to unwrap the _doc wrapper from effective_mappings by checking if the map contains MapperService.SINGLE_MAPPING_NAME and extracting the inner map if present.

  2. UpdateDataStreamMappingsAction.java: Applied the same fix to DataStreamMappingsResponse.toXContent() method.

  3. YAML tests: Updated test assertions in 250_data_stream_mappings.yml to expect effective_mappings.properties instead of effective_mappings._doc.properties.

Testing

  • ✅ Unit tests pass: GetDataStreamMappingsActionTests and UpdateDataStreamMappingsActionResponseTests
  • ✅ YAML rest tests pass: modules:data-streams:yamlRestTest
  • ✅ Code compiles successfully

Related

Note: This PR was automatically created by Augment Agent and has not been assigned to anyone.

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
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