# Rejecting mapping update for new index

**URL:** https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576
**Category:** Logstash
**Created:** [November 29, 2017, 11:19am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576 "2017-11-29T11:19:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [November 29, 2017, 11:19am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576/1 "2017-11-29T11:19:33Z")

</div>

Hi,

I am using ELK GA 6, and I am trying to create a brand new index. Before pushing into the topic using Logstash, I have created a template like below;

```
PUT _template/my_template
{
  "index_patterns": ["mylogs*"],
  "mappings": {
    "type1": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "beat": {
          "properties": {
            "hostname": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              }
            },
            "name": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              }
            },
            "version": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              }
            }
          }
        },
        "f6": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f1": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f8": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f3": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f2": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "message": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f7": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f4": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "offset": {
          "type": "long"
        },
        "prospector": {
          "properties": {
            "type": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              }
            }
          }
        },
        "source": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "f5": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "timestamp": {
          "type": "date",
          "format": "MMM dd, YYYY h:mm:ss:SSS aa"
        }
      }
    }
  }
}

```

below is my logstash configuration;

```
input {
	kafka{
		group_id => "group_1"
		topics => ["topic_1"]
		bootstrap_servers => "192.168.0.1:9092"
		codec => json
	}
}

filter {
	grok {
		match => { "message" => "<(?<timestamp>%{MONTH} %{MONTHDAY}, 20%{YEAR} %{HOUR}:?%{MINUTE}(?::?%{SECOND}) (?:AM|PM))\> <%{NOTSPACE:f1}> <%{NOTSPACE:f2}> <%{NOTSPACE:f3}> <%{NOTSPACE:f4}> <%{NOTSPACE:f5}> <%{NOTSPACE:f6}> <%{NOTSPACE:f7}>\n <%{GREEDYDATA:f8}>" }
 	}

	date {
		match => ["timestamp", "MMM dd, YYYY h:mm:ss:SSS aa"]
		timezone => "UTC"
		target => "@timestamp"
	}
}

output{
	elasticsearch {
		hosts => ["192.168.0.1"]
		index => "mylogs-%{+YYYY-MM-dd}"
	}
}

```

when I try to execute this, I am getting the error like;

```
[2017-11-29T16:55:46,753][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"mylogs-2017-11-24", :_type=>"doc", :_routing=>nil}, #<LogStash::Event:0x100cee42>], :response=>{"index"=>{"_index"=>"mylogs-2017-11-24", "_type"=>"doc", "_id"=>"l5OGB2AB6TiNi_DsjbZm", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"Rejecting mapping update to [mylogs-2017-11-24] as the final mapping would have more than 1 type: [doc, type1]"}}}}

```

Why is this happening and how can I fix this?

Thanks.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [November 29, 2017, 11:25am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576/2 "2017-11-29T11:25:51Z")

</div>

> [@elasticcloud](#):
>
> type1

Indices created in 6.0 can only have a single type. The default value set by the elasticsearch output plugin is `doc`, which does not match what you have in the index template (`type1`). The records are therefore rejected by Elasticsearch.

---

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [November 29, 2017, 11:38am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576/3 "2017-11-29T11:38:00Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> doc

Ok, I understand.

In Kibana console, I did `DELETE _template/my_template` and I made the new post, by replacing `type1` to `doc`. Now the problem is

```
[2017-11-29T17:10:11,488][WARN][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"mylogs-2017-11-24", :_type=>"doc", :_routing=>nil}, #<LogStash::Event:0x7d482463>], :response=>{"index"=>{"_index"=>"mylogs-2017-11-24", "_type"=>"doc", "_id"=>"opOTB2AB6TiNi_Dsv7Yw", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"Rejecting mapping update to [mylogs-2017-11-24] as the final mapping would have more than 1 type: [doc, type1]"}}}}

```

am I doing it wrong? 😞

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [November 29, 2017, 11:40am UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576/4 "2017-11-29T11:40:53Z")

</div>

It seems 'type1' is still present, so you need to delete the index as well so that the new, updated template can be applied when it is recreated.

---

<div class="post-metadata">

### Author: ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)
#### Post date: [November 29, 2017, 12:43pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576/5 "2017-11-29T12:43:27Z")

</div>

Deleted the template and the index as well. Now its working fine 👍😀

---

<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: [December 27, 2017, 12:43pm UTC](https://discuss.elastic.co/t/rejecting-mapping-update-for-new-index/109576/6 "2017-12-27T12:43:40Z")

</div>

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