Skip to content

Index templates are not compatible with file-based component templates #118594

@jeanfabrice

Description

@jeanfabrice

Elasticsearch Version

8.16.1

Installed Plugins

none

Java Version

bundled

OS Version

Kubernetes 1.30.4 on Ubuntu 22.04

Problem Description

Elasticsearch returns HTTP/400 when creating an index template via API call where one of the associated component templates is a file-based component template

This, for example, prevents integration from upgrading when it ships with an updated index templates.
E.g:
Image

(I'm sorry I can't copy-paste the error as the message is not persistent when I try to move my mouse to select it.)

Additional context in these Slack threads:

Steps to Reproduce

  1. Create and apply test@custom component template via ECK stackconfigpolicy
apiVersion: stackconfigpolicy.k8s.elastic.co/v1alpha1
kind: StackConfigPolicy
metadata:
  name: elasticsearch
spec:
  elasticsearch:
    indexTemplates:
      componentTemplates:
        test@custom:
          template:
            settings:
              refresh_interval: "10s"
  1. Wait for the stackconfigpolicy to be in ready phase (change propagated)
$ k get stackconfigpolicies.stackconfigpolicy.k8s.elastic.co elasticsearch 
NAME            READY   PHASE   AGE
elasticsearch   2/2     Ready   1d
  1. Go to Kibana developer tools and create a test index template this way
PUT _index_template/test
{
  "index_patterns": ["test*"],
  "template": {
    "settings": {},
    "mappings": {}
  },
  "priority": 200,
  "composed_of": ["test@custom","test2@custom"],
  "ignore_missing_component_templates": ["test@custom","test2@custom"]
}
  1. See the error returned
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": """Failed to process request [PutTemplateV2Request[name=test, cause=api, create=false, index_template={"index_patterns":["test*"],"template":{"settings":{}},"composed_of":["test@custom","test2@custom"],"priority":200,"ignore_missing_component_templates":["test@custom","test2@custom"]}]] with errors: [[component_template:test@custom] is reserved by [file_settings]]"""
      }
    ],
    "type": "illegal_argument_exception",
    "reason": """Failed to process request [PutTemplateV2Request[name=test, cause=api, create=false, index_template={"index_patterns":["test*"],"template":{"settings":{}},"composed_of":["test@custom","test2@custom"],"priority":200,"ignore_missing_component_templates":["test@custom","test2@custom"]}]] with errors: [[component_template:test@custom] is reserved by [file_settings]]"""
  },
  "status": 400
}

Logs (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions