Skip to content

Backport Pass SearchLookup supplier through to fielddataBuilder (#61430)#61638

Merged
javanna merged 1 commit intoelastic:7.xfrom
javanna:backport/61430
Aug 27, 2020
Merged

Backport Pass SearchLookup supplier through to fielddataBuilder (#61430)#61638
javanna merged 1 commit intoelastic:7.xfrom
javanna:backport/61430

Conversation

@javanna
Copy link
Copy Markdown
Contributor

@javanna javanna commented Aug 27, 2020

This is the backport PR for #61430 .

Runtime fields need to have a SearchLookup available, when building their fielddata implementations, so that they can look up other fields, runtime or not.

To achieve that, we add a Supplier<SearchLookup> argument to the existing MappedFieldType#fielddataBuilder method.

As we introduce the ability to look up other fields while building fielddata for mapped fields, we implicitly add the ability for a field to require other fields. This requires some protection mechanism that detects dependency cycles to prevent stack overflow errors.

With this commit we also introduce detection for cycles, as well as a limit on the depth of the references for a runtime field. Note that we also plan on introducing cycles detection at compile time, so the runtime cycles detection is a last resort to prevent stack overflow errors but we hope that we can reject runtime fields from being registered in the mappings when they create a cycle in their definition.

Note that this commit does not introduce any production implementation of runtime fields, but is rather a pre-requisite to merge the runtime fields feature branch.

This is a breaking change for MapperPlugins that plug in a mapper, as the signature of MappedFieldType#fielddataBuilder changes from taking a single argument (the index name), to also accept a Supplier<SearchLookup>.

Relates to elastic#59332

Co-authored-by: Nik Everett <nik9000@gmail.com>
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types backport labels Aug 27, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Aug 27, 2020
@javanna javanna merged commit f769821 into elastic:7.x Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants