# Elastic output plugin: result \_type in Elastic is always "doc"

**URL:** https://discuss.elastic.co/t/elastic-output-plugin-result-type-in-elastic-is-always-doc/108382
**Category:** Logstash
**Created:** [November 20, 2017, 12:15pm UTC](https://discuss.elastic.co/t/elastic-output-plugin-result-type-in-elastic-is-always-doc/108382 "2017-11-20T12:15:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Andrey\_Tomilin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrey_tomilin/32/77563_2.png) [@Andrey\_Tomilin](https://discuss.elastic.co/u/Andrey_Tomilin)
#### Post date: [November 20, 2017, 12:15pm UTC](https://discuss.elastic.co/t/elastic-output-plugin-result-type-in-elastic-is-always-doc/108382/1 "2017-11-20T12:15:01Z")

</div>

I am using the latest (6.0) ElasticStack for clear setup (no migrations)

I have the following type mapping:

> ```
> PUT my_index
> {
> "mappings": {
> "my_type":
> {
> "dynamic": "strict",
> "properties":
> {
> "CampaignId": { "type": "integer"},
> "DepartmentId": { "type": "integer"},
> "CompanyId": { "type": "integer"},
> "Budget": { "type": "double"},
> "StartDate": { "type": "date"},
> "EndDate": { "type": "date"}
> }
> }
> }
> }
> 
> ```

Adding a new document works fine and creates a document with the \_type=my\_type

> ```
> POST my_index/my_type
> {
> "CampaignId" : 12,
> "DepartmentId" : 10,
> "CompanyId": 100,
> "Budget": 123.123
> }
> 
> ```

But when I use the Logstash it creates documents with \_type=doc and fail to add them into the index with this error:.

> Rejecting mapping update to [my\_index] as the final mapping would have more than 1 type: [my\_type, doc]

I can fix it by adding the **document\_type =\> "my\_type"** , but it's obsolete in version 6, so suspect it should work without it or there is another way to specify the \_type.

Logstash conf:

> ```
> input { jdbc { ... } }
> filter { }
> output 
> {
> elasticsearch 
> {
> hosts => "localhost:9200"
> index => "my_index"
> action => update
> document_id => "%{FieldId}"
> doc_as_upsert => true
> }
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [November 21, 2017, 6:48pm UTC](https://discuss.elastic.co/t/elastic-output-plugin-result-type-in-elastic-is-always-doc/108382/2 "2017-11-21T18:48:43Z")

</div>

In V6 an index can [only have a single type](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html). If you want that type to be "my\_type" then setting it with document\_type in the logstash output is the right thing to do. Yes, it is deprecated now, but that's what it is for. Or else add the documents as type doc to start with.

---

<div class="post-metadata">

### Author: ![Andrey\_Tomilin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrey_tomilin/32/77563_2.png) [@Andrey\_Tomilin](https://discuss.elastic.co/u/Andrey_Tomilin)
#### Post date: [November 21, 2017, 8:12pm UTC](https://discuss.elastic.co/t/elastic-output-plugin-result-type-in-elastic-is-always-doc/108382/3 "2017-11-21T20:12:37Z")

</div>

Yep, i want the **my-type** will be the single type in the **my\_index**.  
It seems to me very strange, that it's "the right thing to do".  
Usually if something is obsolete, there is a replacement and the old way is not intended to be used in a new code. Suspect there is some else explanation.  
But thanks for the answer.

---

<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 19, 2017, 8:13pm UTC](https://discuss.elastic.co/t/elastic-output-plugin-result-type-in-elastic-is-always-doc/108382/4 "2017-12-19T20:13:02Z")

</div>

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