Skip to content

[8.4] Assign the right path to objects merged when parsing mappings (#89389)#89420

Merged
javanna merged 1 commit intoelastic:8.4from
javanna:backport/8.4/pr-89389
Aug 17, 2022
Merged

[8.4] Assign the right path to objects merged when parsing mappings (#89389)#89420
javanna merged 1 commit intoelastic:8.4from
javanna:backport/8.4/pr-89389

Conversation

@javanna
Copy link
Copy Markdown
Contributor

@javanna javanna commented Aug 17, 2022

Backports the following commits to 8.4:

…c#89389)

When parsing mappings, we may find a field with same name specified twice, either
because JSON duplicate keys are allowed, or because a mix of object notation and dot
notation is used when providing mappings. The same can happen when applying dynamic
mappings as part of parsing an incoming document, as well as when merging separate
index templates that may contain the definition for the same field using a
mix of object notation and dot notation.

While we propagate the MapperBuilderContext across merge calls thanks to elastic#86946, we do not
propagate the right context when we call merge on objects as part of parsing/building
mappings. This causes a situation in which the leaf fields that result from the merge
have the wrong path, which misses the first portion e.g. sub.field instead of obj.sub.field.

This commit applies the correct mapper builder context when building the object mapper builder
and two objects with same name are found.

Relates to elastic#86946

Closes elastic#88573
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types >bug backport Team:Search Meta label for search team labels Aug 17, 2022
@javanna javanna merged commit 9eefc03 into elastic:8.4 Aug 17, 2022
@mark-vieira mark-vieira added v8.4.0 and removed v8.4.1 labels Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport >bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v8.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants