Component template and _tier_preference index setting

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.

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

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?

1 Like

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.

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