# I am trying to add ingore\_malformed to true on an existing field in elasticsearch 6.7 and see mapping type is missing error, How to handle this?

**URL:** <https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565>\
**Category:** Elasticsearch\
**Created:** [April 10, 2020, 9:27pm UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565 "2020-04-10T21:27:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssunkara](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@ssunkara](https://discuss.elastic.co/u/ssunkara)\
**Post date:** [April 10, 2020, 9:27pm UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565/1 "2020-04-10T21:27:28Z")

</div>

```auto
PUT/<index pattern>/_mapping
{
  "properties": {
    "max_size":{
      "type":"long", 
      "ignore_malformed": true
    }
  }
}

Response be like 

  "error": {
    "root_cause": [
      {
        "type": "action_request_validation_exception",
        "reason": "Validation Failed: 1: mapping type is missing;"
      }
    ],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: mapping type is missing;"
  },
  "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 10, 2020, 10:41pm UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565/2 "2020-04-10T22:41:59Z")

</div>

Are you on Elasticsearch 6.x or 7.x?

There is a difference between those versions. You have to specify the type in the API request.  
See [https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html#indices-put-mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html#indices-put-mapping) vs  
[https://www.elastic.co/guide/en/elasticsearch/reference/6.5/indices-put-mapping.html#indices-put-mapping](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/indices-put-mapping.html#indices-put-mapping)

E.g.

```auto
PUT <index pattern>/_mapping/_doc 
{ ...

```

Replace `_doc` by the type name you're using.

---

<div class="post-metadata">

**Author:** ![ssunkara](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@ssunkara](https://discuss.elastic.co/u/ssunkara)\
**Post date:** [April 10, 2020, 11:01pm UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565/3 "2020-04-10T23:01:51Z")

</div>

As mentioned in the description we are on 6.7 means 6.x

What do you mean by type name?

I have copied my actual response in the question. So what will be the type name in my case\>

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 11, 2020, 2:20am UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565/4 "2020-04-11T02:20:52Z")

</div>

Do:

```
PUT/<index pattern>/_mapping
{
  "properties": {
    "_doc":
    "max_size":{
      "type":"long", 
      "ignore_malformed": true
    }
  }}
}
```

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 11, 2020, 12:52pm UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565/5 "2020-04-11T12:52:18Z")

</div>

Any of the following work:

```auto
PUT /<index pattern>/_mapping/_doc
{
  "properties": {
    "max_size":{
      "type":"long", 
      "ignore_malformed": true
    }
  }
}

```

```auto
PUT /<index pattern>/_mapping?include_type_name=false
{
  "properties": {
    "max_size":{
      "type":"long", 
      "ignore_malformed": true
    }
  }
}

```

Replace `_doc` by the type name you're using.

If you don't know the `type` you're using, get it using `GET <index pattern>/_mapping?include_type_name=true`.

E.g.

```auto
{
  "<index name>" : {
    "mappings" : {
      "_doc" : { <<<< THIS ONE
        "properties" : {
          "max_size" : {
            "type" : "long",
            "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:** [May 9, 2020, 12:52pm UTC](https://discuss.elastic.co/t/i-am-trying-to-add-ingore-malformed-to-true-on-an-existing-field-in-elasticsearch-6-7-and-see-mapping-type-is-missing-error-how-to-handle-this/227565/6 "2020-05-09T12:52:26Z")

</div>

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