Move mapper merging logic to Mapper.Builder#142754
Merged
romseygeek merged 33 commits intoelastic:mainfrom Feb 23, 2026
Merged
Conversation
…rate on CompressedXContent and Builders
…h other Parameters
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
…apper/builder-merge
martijnvg
approved these changes
Feb 23, 2026
Member
martijnvg
left a comment
There was a problem hiding this comment.
Thanks @romseygeek, this on its own is a good refactoring. Looking forward when all the pieces of #142753 are in.
| // and it should not be reassigned below. | ||
| // For now it is still possible to set `_source.mode` so this is correct. | ||
| boolean isSourceSynthetic = SourceFieldMapper.isSynthetic(mappingParserContext.getIndexSettings()); | ||
| boolean isDataStream = false; |
Member
There was a problem hiding this comment.
nice to see this now being better handled in MappingBuilder
Contributor
Author
|
CI is failing due to an unrelated failure that is failing on a bunch of other PRs as well, so this is good to merge. |
5 tasks
sidosera
pushed a commit
to sidosera/elasticsearch
that referenced
this pull request
Feb 24, 2026
This is the first step for elastic#142753 It's a pretty large and complex PR, which unfortunately is tricky to break down into smaller pieces. Here's a summary of what it contains: - A new MappingBuilder object that holds Builders for a RootObjectMapper and various MetadataFieldMappers. This handles all merging, meaning that the merge methods on Mapping and Mapper are removed - MapperService takes input merges as CompressedXContent rather than parsed Mapping objects - MappingParser returns a MappingBuilder rather than a Mapping - DocumentParser switches to use Builders to build dynamic mappings - The various Builder classes for each field type are updated to add a contentType() method, to be used for error messages in merging. - MetadataFieldMappers now all have Builders - ObjectMapper merging is all done on the Builder, which is mostly just moving code around but adds some nice simplifications as well.
mayya-sharipova
added a commit
to mayya-sharipova/elasticsearch
that referenced
this pull request
Mar 2, 2026
PR elastic#130540 introduced a bug where indexing a document with a dotted field name (e.g. "my_vectors.vector1") matched by a dynamic template for dense_vector or rank_vectors without explicit dims would fail with: IllegalStateException: Missing intermediate object. The bug only manifests when dims are not set in the mapping or template, triggering the code path that dynamically determines dimensions from the first indexed document. The root cause is that when DenseVectorFieldMapper and RankVectorsFieldMapper dynamically determine dims, they rebuild the mapper using the document parser's content path. For dynamically mapped fields with dotted names, the content path includes the field name itself rather than just the parent object path, producing a duplicated full path in the rebuilt mapper. This was fixed on main/9.4 by PR elastic#142754, which refactored dynamic mapper tracking to use Mapper.Builder objects. This commit provides a targeted fix for 9.3.x by deriving the correct parent path from the existing mapper's fullPath instead of relying on the content path. The same fix is applied to both DenseVectorFieldMapper and RankVectorsFieldMapper, which shared the same bug.
mayya-sharipova
added a commit
that referenced
this pull request
Mar 3, 2026
PR #130540 introduced a bug where indexing a document with a dotted field name (e.g. "my_vectors.vector1") matched by a dynamic template for dense_vector or rank_vectors without explicit dims would fail with: IllegalStateException: Missing intermediate object. The bug only manifests when dims are not set in the mapping or template, triggering the code path that dynamically determines dimensions from the first indexed document. The root cause is that when DenseVectorFieldMapper and RankVectorsFieldMapper dynamically determine dims, they rebuild the mapper using the document parser's content path. For dynamically mapped fields with dotted names, the content path includes the field name itself rather than just the parent object path, producing a duplicated full path in the rebuilt mapper. This was fixed on main/9.4 by PR #142754, which refactored dynamic mapper tracking to use Mapper.Builder objects. This commit provides a targeted fix for 9.3.x by deriving the correct parent path from the existing mapper's fullPath instead of relying on the content path. The same fix is applied to both DenseVectorFieldMapper and RankVectorsFieldMapper, which shared the same bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first step for #142753
It's a pretty large and complex PR, which unfortunately is tricky to break down into smaller pieces. Here's a summary of what it contains: