# Can't get rid of \_source

**URL:** <https://discuss.elastic.co/t/cant-get-rid-of--source/11491>\
**Category:** Elasticsearch\
**Created:** [April 8, 2013, 6:52pm UTC](https://discuss.elastic.co/t/cant-get-rid-of--source/11491 "2013-04-08T18:52:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marian/32/442_2.png) [@marian](https://discuss.elastic.co/u/marian)\
**Post date:** [April 8, 2013, 6:52pm UTC](https://discuss.elastic.co/t/cant-get-rid-of--source/11491/1 "2013-04-08T18:52:06Z")

</div>

Hi!

I am creating an index, creating a mapping and importing documents via pyes  
into ElasticSearch version 0.20.6.

Although my mapping should disable the \_source field, all result items  
still contain that field. Is this a problem with pyes?

This is my code, basically:

es.indices.create\_index(new\_index)  
mapping = {  
'\_source': {'enabled': False},  
'\_all': {'enabled': True},  
...  
}  
es.indices.put\_mapping("submission", {'properties': mapping}, [new\_index])

Even the \_mapping output from ES confirms this:

submission:  
{  
properties:  
{  
\_source:  
{  
type: "object",  
enabled: false},  
...

However, all my search output contains the \_source field per document.

Marian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [April 9, 2013, 6:32am UTC](https://discuss.elastic.co/t/cant-get-rid-of--source/11491/2 "2013-04-09T06:32:06Z")

</div>

Hi Marian,

I think the problem is that your "\_source" ended up under "properties", as  
if it would be a field from your document. It should be directly under your  
"submissions" mapping type. Like:

'submissions': {  
'\_source': {  
'enabled': False  
},  
'properties': {  
#your document's properties here  
}  
}

I'm not sure how to fix the issue from pyes, I guess you need to make it  
like the above and then send with es.indices.put\_mapping("submission",  
mapping, [new\_index])

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Mon, Apr 8, 2013 at 9:52 PM, Marian Steinbach \<[marian.steinbach@gmail.com](mailto:marian.steinbach@gmail.com)

> wrote:

> Hi!
> 
> I am creating an index, creating a mapping and importing documents via  
> pyes into Elasticsearch version 0.20.6.
> 
> Although my mapping should disable the \_source field, all result items  
> still contain that field. Is this a problem with pyes?
> 
> This is my code, basically:
> 
> es.indices.create\_index(new\_index)  
> mapping = {  
> '\_source': {'enabled': False},  
> '\_all': {'enabled': True},  
> ...  
> }  
> es.indices.put\_mapping("submission", {'properties': mapping}, [new\_index])
> 
> Even the \_mapping output from ES confirms this:
> 
> submission:  
> {  
> properties:  
> {  
> \_source:  
> {  
> type: "object",  
> enabled: false},  
> ...
> 
> However, all my search output contains the \_source field per document.
> 
> Marian
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![marian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marian/32/442_2.png) [@marian](https://discuss.elastic.co/u/marian)\
**Post date:** [April 9, 2013, 8:03am UTC](https://discuss.elastic.co/t/cant-get-rid-of--source/11491/3 "2013-04-09T08:03:13Z")

</div>

Am Dienstag, 9. April 2013 08:32:06 UTC+2 schrieb Radu Gheorghe:

> Hi Marian,
> 
> I think the problem is that your "\_source" ended up under "properties", as  
> if it would be a field from your document. It should be directly under your  
> "submissions" mapping type. Like: [..]

That was the reason, exactly. Thank you very much!

Marian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:42am UTC](https://discuss.elastic.co/t/cant-get-rid-of--source/11491/4 "2017-07-06T02:42:07Z")

</div>


