# Request body is required when updating an index template using the Dev console

**URL:** <https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775>\
**Category:** Elasticsearch\
**Created:** [January 7, 2022, 5:57pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775 "2022-01-07T17:57:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev9](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dev9/32/81258_2.png) [@dev9](https://discuss.elastic.co/u/dev9)\
**Post date:** [January 7, 2022, 5:57pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/1 "2022-01-07T17:57:11Z")

</div>

Hi,  
How do I update an index template using the Dev Console? when I tried the below, I got a parse exception request body is required. I am using the latest version of elastic

```auto
PUT _index_template/test/

  {
          "mappings" : {
            "properties" : {
              "clientID" : {
                "type" : "ip",
                "ignore_malformed": true
              }
            }
          }
}

```

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [January 7, 2022, 6:05pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/2 "2022-01-07T18:05:45Z")

</div>

You have a space between your PUT and body therefore dev tools doesn't think they are connected. Try this.

```auto
PUT _index_template/test/
{
  "mappings": {
    "properties": {
      "clientID": {
        "type": "ip",
        "ignore_malformed": true
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![dev9](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dev9/32/81258_2.png) [@dev9](https://discuss.elastic.co/u/dev9)\
**Post date:** [January 7, 2022, 6:09pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/3 "2022-01-07T18:09:16Z")

</div>

Thanks @aaron-nimocks but now I am getting

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "x_content_parse_exception",
        "reason" : "[2:11] [index_template] unknown field [mappings]"
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[2:11] [index_template] unknown field [mappings]"
  },
  "status" : 400
}

```

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [January 7, 2022, 6:11pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/4 "2022-01-07T18:11:34Z")

</div>

Check out the documentation for [index templates](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-templates.html#create-index-templates). There is a sample provided.

---

<div class="post-metadata">

**Author:** ![dev9](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dev9/32/81258_2.png) [@dev9](https://discuss.elastic.co/u/dev9)\
**Post date:** [January 7, 2022, 6:27pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/5 "2022-01-07T18:27:10Z")

</div>

I actually did that before posting here and I read it again.  
The first two parts/examples are for component templates using the \_component\_template API.

The first property that comes up in the intellisense are aliases, mappings, index\_pattern, setting and version..  
I am only trying to update an existing field in the template.

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [January 7, 2022, 6:49pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/6 "2022-01-07T18:49:41Z")

</div>

The example is just below the component templates. Mappings need to be wrapped in `template` and `index_patterns` will be required. I did test intellisense and it appears it's not correct which is probably what's confusing.

```auto
PUT _index_template/test/
{
  "index_patterns": ["---"], 
  "template": {
    "mappings": {
      "properties": {
        "clientID": {
          "type": "ip",
          "ignore_malformed": true
        }
      }
    }
  }
}

```

---

<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 4, 2022, 6:50pm UTC](https://discuss.elastic.co/t/request-body-is-required-when-updating-an-index-template-using-the-dev-console/293775/7 "2022-02-04T18:50:31Z")

</div>

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