# How get the document field when disable the \_source?

**URL:** <https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941>\
**Category:** Elasticsearch\
**Created:** [August 6, 2015, 6:03am UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941 "2015-08-06T06:03:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gin](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@gin](https://discuss.elastic.co/u/gin)\
**Post date:** [August 6, 2015, 6:03am UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941/1 "2015-08-06T06:03:41Z")

</div>

Hi,

I'm trying to disable \_source as in my case the updated and reindex are unnecessary feature.  
The issue is I cannot get any field when the \_source is diabled.

I created a index like:  
curl -XPUT [http://localhost:9200/test1](http://localhost:9200/test1) -d '{"mappings":{"test":{"\_source":{"enabled": false}}}}'  
{"acknowledged":true}  
and put a document in:  
curl -XPUT [http://localhost:9200/test1/test/1](http://localhost:9200/test1/test/1) -d '{"f1":"1111","f2":"222"}'  
{"\_index":"test1","\_type":"test","\_id":"1","\_version":1,"created":true}

when try to get this document only the meta field returned  
curl -XGET [http://localhost:9200/test1/test/1](http://localhost:9200/test1/test/1)  
{"\_index":"test1","\_type":"test","\_id":"1","\_version":1,"found":true}

Is there something wrong?

Thanks

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [August 6, 2015, 8:29am UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941/2 "2015-08-06T08:29:47Z")

</div>

There is nothing wrong, Elasticsearch is working as expected. The field values are stored in the `_source` field and when you get a document this is what is returned. If you disable `_source` no fields will be stored and therefore will not be shown on a get request. You need to re-enable your `_source` field. Disabling the `_source` field is generally not recommend as is only useful in instances where you never need the stored values of the fields.

---

<div class="post-metadata">

**Author:** ![gin](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@gin](https://discuss.elastic.co/u/gin)\
**Post date:** [August 7, 2015, 12:18am UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941/3 "2015-08-07T00:18:04Z")

</div>

Hi Colin

Thanks for your answers. Seems I need to manally controle which field need to be store if the \_source was disabled, right?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 7, 2015, 1:32am UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941/4 "2015-08-07T01:32:35Z")

</div>

Correct, but why not store \_source?

---

<div class="post-metadata">

**Author:** ![gin](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@gin](https://discuss.elastic.co/u/gin)\
**Post date:** [August 12, 2015, 2:11am UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941/5 "2015-08-12T02:11:31Z")

</div>

For insert performance concern. As elasticsearch generate lots of extra inform far beyond the docment itself, I'd like to disable them which feature I didn't need.  
But seems the \_source is the one I need.

---

<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 5, 2017, 11:56pm UTC](https://discuss.elastic.co/t/how-get-the-document-field-when-disable-the--source/26941/6 "2017-07-05T23:56:20Z")

</div>


