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

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

PUT _index_template/test/

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

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

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

Thanks @aaron-nimocks but now I am getting

{
  "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
}

Check out the documentation for index templates. There is a sample provided.

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.

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.

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

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