Skip to content

Commit

Permalink
Update source in DocumentMapper to include synthetic source.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkrik-es committed Aug 21, 2023
1 parent 570928d commit f5b8948
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,18 @@ public static DocumentMapper createEmpty(MapperService mapperService) {
this.documentParser = documentParser;
this.type = mapping.getRoot().name();
this.mappingLookup = MappingLookup.fromMapping(mapping);
this.mappingSource = source;
assert mapping.toCompressedXContent().equals(source)
: "provided source [" + source + "] differs from mapping [" + mapping.toCompressedXContent() + "]";
if (sourceMapper().isSynthetic() && source.string().contains("\"_source\":{\"mode\":\"synthetic\"}") == false) {
/*
* Indexes built at v.8.7 were missing an explicit entry for synthetic_source.
* This got restored in v.8.9 (and patched in v.8.8) to avoid confusion. The change is only restricted to
* mapping printout, it has no functional effect as the synthetic source already applies.
*/
this.mappingSource = mapping.toCompressedXContent();
} else {
assert mapping.toCompressedXContent().equals(source)
: "provided source [" + source + "] differs from mapping [" + mapping.toCompressedXContent() + "]";
this.mappingSource = source;
}
}

public Mapping mapping() {
Expand Down

0 comments on commit f5b8948

Please sign in to comment.