# Why is my document result embedded in "doc" field when importing via Logstash to Elasticsearch?

**URL:** https://discuss.elastic.co/t/why-is-my-document-result-embedded-in-doc-field-when-importing-via-logstash-to-elasticsearch/212827
**Category:** Logstash
**Created:** [December 23, 2019, 9:59am UTC](https://discuss.elastic.co/t/why-is-my-document-result-embedded-in-doc-field-when-importing-via-logstash-to-elasticsearch/212827 "2019-12-23T09:59:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![michalz](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@michalz](https://discuss.elastic.co/u/michalz)
#### Post date: [December 23, 2019, 9:59am UTC](https://discuss.elastic.co/t/why-is-my-document-result-embedded-in-doc-field-when-importing-via-logstash-to-elasticsearch/212827/1 "2019-12-23T09:59:29Z")

</div>

Hi, I created a pipeline in logstash, and and an index in elasticsearch. I am importing data from couch db. Yet the documents I retrieve are wrapped in an additional field "doc" (within "\_source" that I don't want):  
"hits" : [  
{  
"\_index" : "my\_index",  
"\_type" : "\_doc",  
"\_id" : "some id",  
"\_score" : 1.0,  
"\_source" : {  
"doc" : {  
"x":"some value",  
//other fields and values  
}  
}  
}  
}  
]

How is this "doc" even inserted into my\_index if it is not defined there?  
This is the beginning of my index mapping definition:  
{  
"wsa\_profiles\_db\_index" : {  
"aliases" : { },  
"mappings" : {  
"dynamic" : "false",  
"properties" : {  
"x" : {  
"properties" : {  
"x1" : {  
//and it continues

My output elasticsearch plugin in logstash is as follows:  
elasticsearch {  
hosts =\> ["elasticsearch:9200"]  
index =\> "my\_index"  
document\_id =\> "%{[@metadata][\_id]}"  
action =\> "update"  
doc\_as\_upsert =\> "true"  
}

In the filter{} clause I only remove fields so I do not add any "doc" field.  
And in couchdb I do not embed anything into this "doc " field.  
How to get rid of "doc"-embedding?  
Could you please help? I am new to ELK. I would greatly appreciate that 🙂

---

<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: [January 20, 2020, 10:05am UTC](https://discuss.elastic.co/t/why-is-my-document-result-embedded-in-doc-field-when-importing-via-logstash-to-elasticsearch/212827/2 "2020-01-20T10:05:17Z")

</div>

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