Skip to content

[series/9.x] fix GetIndexTemplate: properly deserialize dynamic_templates and nested mappings#3967

Open
bambuchaAdm wants to merge 1 commit into
Philippus:series/9.xfrom
bambuchaAdm:fix/get-index-template-dynamic-templates
Open

[series/9.x] fix GetIndexTemplate: properly deserialize dynamic_templates and nested mappings#3967
bambuchaAdm wants to merge 1 commit into
Philippus:series/9.xfrom
bambuchaAdm:fix/get-index-template-dynamic-templates

Conversation

@bambuchaAdm

Copy link
Copy Markdown

Fix deserialization of GetIndexTemplate responses.

Two bugs fixed:

  • dynamic_templates was silently dropped. ES encodes it as an array of single-key objects ([{"name": {...}}]) which Jackson cannot automatically map. Now parsed via DynamicTemplateBuilderFn.fromMap, reusing
    the existing ElasticFieldBuilderFn.construct for the nested mapping field.
  • settings, mappings, aliases were always empty. The composable _index_template API nests them under a template sub-object in the response; the old case class looked at the top level and found nothing.

Changes:

  • Add TemplateMappings(dynamicTemplates: Seq[DynamicTemplateRequest], properties: Seq[ElasticField]) — typed replacement for IndexTemplate.mappings: Map[String, Any]
  • Add DynamicTemplateBuilderFn with fromMap / fromMappingsMap deserialization
  • Add private raw Jackson intermediate types matching the actual composable template response structure, convert to public typed API in response handler

Breaking change: IndexTemplate.mappings type changes from Map[String, Any] to TemplateMappings.

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant