# Need help for error " java.lang.IllegalArgumentException: Rejecting mapping update to \[logstash-git\] as the final mapping would have more than 1 type: \[\_doc, doc\]"

**URL:** https://discuss.elastic.co/t/need-help-for-error-java-lang-illegalargumentexception-rejecting-mapping-update-to-logstash-git-as-the-final-mapping-would-have-more-than-1-type-doc-doc/171499
**Category:** Logstash
**Created:** [March 8, 2019, 1:24pm UTC](https://discuss.elastic.co/t/need-help-for-error-java-lang-illegalargumentexception-rejecting-mapping-update-to-logstash-git-as-the-final-mapping-would-have-more-than-1-type-doc-doc/171499 "2019-03-08T13:24:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cheriemilk](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cheriemilk](https://discuss.elastic.co/u/cheriemilk)
#### Post date: [March 8, 2019, 1:24pm UTC](https://discuss.elastic.co/t/need-help-for-error-java-lang-illegalargumentexception-rejecting-mapping-update-to-logstash-git-as-the-final-mapping-would-have-more-than-1-type-doc-doc/171499/1 "2019-03-08T13:24:51Z")

</div>

Hi team - need your help for this painful issue.

1. My ES Index template with index pattern is **"logstash-git"**

2. My logstash configuration file is

When I start logstash, there is below error in Elasticsearch, looks like there's more than 1 template matches the index logstash-git. But I check all templates that only 1 template matched by http://localhost:9200/\_template?pretty and don't what where **'\_doc'** comes from.

Please help.

---

<div class="post-metadata">

### Author: ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)
#### Post date: [March 12, 2019, 1:19am UTC](https://discuss.elastic.co/t/need-help-for-error-java-lang-illegalargumentexception-rejecting-mapping-update-to-logstash-git-as-the-final-mapping-would-have-more-than-1-type-doc-doc/171499/2 "2019-03-12T01:19:43Z")

</div>

- `_doc` is the default document type in Elasticsearch, if an index is created without one. In Elasticsearch 6.x, an index must have exactly one document type (this is a part of the transition to document types being removed entirely from Elasticsearch)
- a mapping template is used only when a new index is created; if it is not in place before the index is created, then the template has no effect when added. it's useful when you want to have dynamic indices (such as indec-per-day pattern).
- you apparently already have an index `logstash-git` that has a `_doc` as its document type
- I would advise updating your template to be `_doc`, and remove the explicit `document_type` directive from the pipeline's elasticsearch output, as it is no longer necessary.

---

<div class="post-metadata">

### Author: ![cheriemilk](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cheriemilk](https://discuss.elastic.co/u/cheriemilk)
#### Post date: [March 12, 2019, 2:25am UTC](https://discuss.elastic.co/t/need-help-for-error-java-lang-illegalargumentexception-rejecting-mapping-update-to-logstash-git-as-the-final-mapping-would-have-more-than-1-type-doc-doc/171499/3 "2019-03-12T02:25:59Z")

</div>

Hi yaauie,

but I have a template already mapped and from the log of starting logstash, the template already detected. In the template, I clearly defined the document type is 'doc'. why it will still go to find the document type from other unmatched template? The logic seems problematic.

Thanks,  
Cherie

---

<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: [April 9, 2019, 2:26am UTC](https://discuss.elastic.co/t/need-help-for-error-java-lang-illegalargumentexception-rejecting-mapping-update-to-logstash-git-as-the-final-mapping-would-have-more-than-1-type-doc-doc/171499/4 "2019-04-09T02:26:07Z")

</div>

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