Skip to content

Fix effective_mapping field to not include _doc wrapper at top level#9

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

Fix effective_mapping field to not include _doc wrapper at top level#9
augment-app-staging[bot] wants to merge 1 commit intomainfrom
eval-fef151c3

Conversation

@augment-app-staging
Copy link

Summary

Fix the effective_mappings field in the get/update data stream mappings API responses to not include the _doc wrapper at the top level.

Problem

The toXContent() methods in GetDataStreamMappingsAction.DataStreamMappingsResponse and UpdateDataStreamMappingsAction.DataStreamMappingsResponse serialize effective_mappings without stripping the _doc wrapper. This is inconsistent with DataStream.getEffectiveMappings() which already strips it.

Fix

After converting effectiveMappings from CompressedXContent to a map, check if the map contains the _doc key (MapperService.SINGLE_MAPPING_NAME). If it does, unwrap it by using the value under that key instead. This matches the existing pattern in DataStream.getEffectiveMappings().

Files changed:

  • server/src/main/java/org/elasticsearch/action/datastreams/GetDataStreamMappingsAction.java
  • server/src/main/java/org/elasticsearch/action/datastreams/UpdateDataStreamMappingsAction.java

Triggered by: Slack-Bot-Evals
Slack thread: https://augment-wic8570.slack.com/archives/C0AG2MXKEQJ/p1772572830593139

Strip the _doc wrapper from effective_mappings in toXContent() methods of
GetDataStreamMappingsAction.DataStreamMappingsResponse and
UpdateDataStreamMappingsAction.DataStreamMappingsResponse, matching the
pattern already used in DataStream.getEffectiveMappings().
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