[series/9.x] fix GetIndexTemplate: properly deserialize dynamic_templates and nested mappings#3967
Open
bambuchaAdm wants to merge 1 commit into
Conversation
…ed mappings - dynamic_templates silently dropped: ES encodes as array of single-key objects which Jackson cannot auto-map; add DynamicTemplateBuilderFn reusing ElasticFieldBuilderFn.construct for the mapping field - settings/mappings/aliases always empty: composable _index_template nests them under template sub-object; previous case class looked at top level and found nothing - IndexTemplate.mappings type changed from Map[String, Any] to TemplateMappings(dynamicTemplates, properties) - add private raw Jackson intermediate types matching actual response structure, convert to public typed API in response handler
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.
Fix deserialization of
GetIndexTemplateresponses.Two bugs fixed:
dynamic_templateswas silently dropped. ES encodes it as an array of single-key objects ([{"name": {...}}]) which Jackson cannot automatically map. Now parsed viaDynamicTemplateBuilderFn.fromMap, reusingthe existing
ElasticFieldBuilderFn.constructfor the nestedmappingfield.settings,mappings,aliaseswere always empty. The composable_index_templateAPI nests them under atemplatesub-object in the response; the old case class looked at the top level and found nothing.Changes:
TemplateMappings(dynamicTemplates: Seq[DynamicTemplateRequest], properties: Seq[ElasticField])— typed replacement forIndexTemplate.mappings: Map[String, Any]DynamicTemplateBuilderFnwithfromMap/fromMappingsMapdeserializationBreaking change:
IndexTemplate.mappingstype changes fromMap[String, Any]toTemplateMappings.