# Elasticsearch templates

**URL:** <https://discuss.elastic.co/t/elasticsearch-templates/323984>\
**Category:** Kibana\
**Created:** [January 26, 2023, 2:19am UTC](https://discuss.elastic.co/t/elasticsearch-templates/323984 "2023-01-26T02:19:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cybersirp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cybersirp/32/115103_2.png) [@cybersirp](https://discuss.elastic.co/u/cybersirp)\
**Post date:** [January 26, 2023, 2:19am UTC](https://discuss.elastic.co/t/elasticsearch-templates/323984/1 "2023-01-26T02:19:41Z")

</div>

I notice that starting from elasticsearch 8.x everything has changed in relation to working with templates and I am very confused and I would like a Samaritan to help me solve this problem.

```auto
curl -s -H "Content-type: application/json" -X PUT -u elastic:password https://127.0.0.1:9200/_template/scan -d'
{
  "template": "scan-*",
  "settings": {
    "number_of_shards": 1,
    "index.refresh_interval": "5s"
  },
  "mappings": {
    "_default_": {
      "_all": {
        "enabled": false
      },
      "properties": {
        "@timestamp": {
          "type": "date",
          "format": "dateOptionalTime"
        },
        "@version": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "time_t": {
          "type": "date",
          "format": "strict_date_optional_time||epoch_millis"
        },
        "ip": {
          "type": "ip",
          "norms": {
            "enabled": false
          }
        },
        "ip_proto": {
          "type": "string",
          "index": "not_analyzed"
        },
        "port": {
          "type": "integer",
          "index": "not_analyzed"
        },
        "service": {
          "type": "string",
          "index": "not_analyzed"
        },
        "state": {
          "type": "string",
          "index": "not_analyzed"
        },
        "banner": {
          "type": "string",
          "index": "analyzed"
        },        
        "geoip": {
          "type": "object",
          "dynamic": true,
          "properties": {
            "location": {
              "type": "geo_point"
            }
          }
        }
      }
    }
  }
}'

```

Response:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "x_content_parse_exception",
        "reason": "[2:15] [template] template doesn't support values of type: VALUE_STRING"
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[2:15] [template] template doesn't support values of type: VALUE_STRING"
  },
  "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)\
**Post date:** [January 26, 2023, 7:38am UTC](https://discuss.elastic.co/t/elasticsearch-templates/323984/2 "2023-01-26T07:38:04Z")

</div>

Hello @cybersirp , you need to map the String fields as `text`: [Text type family | Elasticsearch Guide [8.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/text.html)

---

<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:** [February 23, 2023, 7:38am UTC](https://discuss.elastic.co/t/elasticsearch-templates/323984/3 "2023-02-23T07:38:31Z")

</div>

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