# Component template and \_tier\_preference index setting

**URL:** https://discuss.elastic.co/t/component-template-and-tier-preference-index-setting/336500
**Category:** Elasticsearch
**Created:** [June 20, 2023, 3:35pm UTC](https://discuss.elastic.co/t/component-template-and-tier-preference-index-setting/336500 "2023-06-20T15:35:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bstdenis](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@bstdenis](https://discuss.elastic.co/u/bstdenis)
#### Post date: [June 20, 2023, 3:35pm UTC](https://discuss.elastic.co/t/component-template-and-tier-preference-index-setting/336500/1 "2023-06-20T15:35:42Z")

</div>

I am trying to use component\_templates per the warning I received after using old index template. It seems to work, other than the \_tier\_preference setting.

Specifically, setting "\_tier\_preference" to "data\_content" or "data\_hot", results in \_tier\_preference of null.

```auto
PUT _component_template/tier_preference_settings
{
  "template": {
    "settings": {
      "index": {
        "number_of_shards": "2",
        "number_of_replicas": "0",
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": "data_hot"
            }
          }
        }
      }
    }
  }
}

put _component_template/tier_preference_mappings
{
  "template": {
    "mappings": {
      "properties": {
        "tp_string": {
          "type": "keyword"
        },
        "tp_date": {
          "type": "date"
        }
      }
    }
  }
}

PUT _index_template/tier_preference_template
{
  "index_patterns": ["tier_preference*"],
  "template": {
    "settings": {
      "routing": {
        "allocation": {
          "include": {
            "_tier_preference": "data_hot"
          }
        }
      } 
    }
  }, 
  "priority": 500,
  "composed_of": ["tier_preference_settings", "tier_preference_mappings"], 
  "version": 1,
  "_meta": {
    "description": "tier preference test"
  }
}

```

Then

```auto
POST /_index_template/_simulate_index/tier_preference-1

{
  "template": {
    "settings": {
      "index": {
        "number_of_shards": "2",
        "number_of_replicas": "0",
        "routing": {
          "allocation": {
            "include": {
              "_tier_preference": null
            }
          }
        }
      }
    },
    "mappings": {
      "properties": {
        "tp_date": {
          "type": "date"
        },
        "tp_string": {
          "type": "keyword"
        }
      }
    },
    "aliases": {}
  },
  "overlapping": []
}

```

What am I missing?

---

<div class="post-metadata">

### Author: ![Nick\_Peelman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_peelman/32/122613_2.png) [@Nick\_Peelman](https://discuss.elastic.co/u/Nick_Peelman)
#### Post date: [June 23, 2023, 3:49am UTC](https://discuss.elastic.co/t/component-template-and-tier-preference-index-setting/336500/2 "2023-06-23T03:49:14Z")

</div>

I ran into this same problem tonight. Really curious if there's a solution...it gets angry and won't validate if you try to do anything other than the allowed `data_hot`, `data_warm`, etc. but once it saves, it shows up as `null`.

---

<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: [July 21, 2023, 3:49am UTC](https://discuss.elastic.co/t/component-template-and-tier-preference-index-setting/336500/3 "2023-07-21T03:49:20Z")

</div>

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