Skip to content

Move mappings merging logic entirely to Mapper.Builder #142753

@romseygeek

Description

@romseygeek

Mapper merging is substantially handled by mutable Builder objects, allowing Mappers
themselves to remain immutable. However, the external merging logic is applied to
Mappers, meaning that each Mapper needs to hold sufficient state to reconstruct a
Builder and then pass off the merging logic there. In addition, things like ObjectMapper
split their merging logic between Mapper and Builder objects.

Mappers are long lived objects, and the additional state that they need to hold to
support merging can cause significant memory pressure.

We can remove enormous amounts of state from Mapper objects if we migrate merging
logic entirely to Builders. This is a major undertaking, and so needs to be split into
several parts:

  • Remove Mapper.merge() and push all merging logic directly to Builders (Move mapper merging logic to Mapper.Builder #142754)
  • Use Builders directly for XContent serialization
  • Remove FieldMapper.getMergeBuilder()
  • Remove Mapper initialisation from FieldMapper.Parameter
  • Remove state from Mappers that is only needed to support FieldMapper.getMergeBuilder()

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions