# StackConfigPolicy ECK Index template fails to create

**URL:** <https://discuss.elastic.co/t/stackconfigpolicy-eck-index-template-fails-to-create/352909>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 9, 2024, 7:20am UTC](https://discuss.elastic.co/t/stackconfigpolicy-eck-index-template-fails-to-create/352909 "2024-02-09T07:20:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PLR-KMD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/plr-kmd/32/131594_2.png) [@PLR-KMD](https://discuss.elastic.co/u/PLR-KMD)\
**Post date:** [February 9, 2024, 7:20am UTC](https://discuss.elastic.co/t/stackconfigpolicy-eck-index-template-fails-to-create/352909/1 "2024-02-09T07:20:45Z")

</div>

Hi,

According to docs on [Elastic Stack configuration policies | Elastic Cloud on Kubernetes [2.11] | Elastic](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-stack-config-policy.html) I'm trying to deploy simple ILM and index template. Everything works fine when I deploy ILM only but I can't get index template to work. I'm using code below:

```auto
apiVersion: stackconfigpolicy.k8s.elastic.co/v1alpha1
kind: StackConfigPolicy
metadata:
  name: metricbeat7d-policy
  namespace: eck
spec:
  elasticsearch:
    indexLifecyclePolicies:
      metricbeat-configpolicytest-7d:
        phases:
          cold:
            actions:
              readonly: {}
              set_priority:
                priority: 0
            min_age: 1d
          delete:
            actions:
              delete: {}
            min_age: 7d
          hot:
            actions:
              forcemerge:
                index_codec: best_compression
                max_num_segments: 1
              rollover:
                max_age: 1d
                max_primary_shard_size: 50GB
            min_age: 0ms
    indexTemplates:
      component_templates: {}
      composableIndexTemplates:
        metricbeat-test:
          composed_of: {}
          data_stream:
            allow_custom_routing: false
            hidden: false
          index_patterns:
            - test-*
          priority: 200
          template:
            settings:
              index:
                lifecycle:
                  name: metricbeat-configpolicytest-7d
                max_docvalue_fields_search: '200'
                refresh_interval: 5s
        version: 1
  resourceSelector:
    matchLabels:
      eckpolicyid: es-central

```

Operator version 2.11.0 on openshift cluster 4.12.45

Error I got in status:

```auto
        error:
          message: >-
            java.lang.IllegalStateException: Error processing state change
            request for file_settings, errors:
            org.elasticsearch.xcontent.XContentParseException: [1:1178]
            [reserved_state_chunk] failed to parse field [state]

            Caused by: org.elasticsearch.xcontent.XContentParseException:
            [1:1178] [state] failed to parse field [index_templates]

            Caused by: java.lang.ClassCastException: class java.lang.Integer
            cannot be cast to class java.util.Map (java.lang.Integer and
            java.util.Map are in module java.base of loader 'bootstrap')

            Caused by: org.elasticsearch.xcontent.XContentParseException:
            [1:1178] [reserved_state_chunk] failed to parse field [state]

            Caused by: org.elasticsearch.xcontent.XContentParseException:
            [1:1178] [state] failed to parse field [index_templates]

            Caused by: java.lang.ClassCastException: class java.lang.Integer
            cannot be cast to class java.util.Map (java.lang.Integer and
            java.util.Map are in module java.base of loader 'bootstrap')

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 8, 2024, 7:21am UTC](https://discuss.elastic.co/t/stackconfigpolicy-eck-index-template-fails-to-create/352909/2 "2024-03-08T07:21:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
