Template for new attributes of an index

Hi All,

I wanted to know if there is a feature in ElasticSearch that allows you to create a template for column names. If I wanted to define something like: All column names beginning with AAA_ should be a keyword. For example if I already had 3 columns AAA_1, AAA_2, AAA_3 defined as keyword. Is there a way for me to create a template that would make any new column that starts with AAA_ to be a keyword?


You can do this with a dynamic mapping template, check out https://www.elastic.co/guide/en/elasticsearch/reference/5.4/dynamic-templates.html#match-unmatch

Here's an example:

PUT my_index
  "mappings": {
    "my_type": {
      "dynamic_templates": [
          "triple-a-keywords": {
            "match_mapping_type": "string",
            "match":   "AAA_*",
            "mapping": {
              "type": "keyword"
1 Like

Thanks. This is what I was looking for!

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