# Deactivate \_source and doc\_values, but can still be queried

**URL:** <https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839>\
**Category:** Elasticsearch\
**Created:** [September 19, 2016, 7:27am UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839 "2016-09-19T07:27:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![TWalter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/twalter/32/41239_2.png) [@TWalter](https://discuss.elastic.co/u/TWalter)\
**Post date:** [September 19, 2016, 7:27am UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/1 "2016-09-19T07:27:47Z")

</div>

Hello everyone,

I am new in working with elasticsearch and found a behaviour which i didn't understand.

If I create an index template with the type setting "\_source": { "enabled" : false}  
and the field mapping "doc\_values": false, the field with the deactivated doc\_values can still be queried.

In my opinion, the information of the field is saved in the datatypes \_source and doc\_values.

Is there another datatype where the Information is saved, too?

Thank you for your help =)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 19, 2016, 7:42am UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/2 "2016-09-19T07:42:30Z")

</div>

So you are looking for not indexing a field, right?

Set `index: no`. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-index.html)

---

<div class="post-metadata">

**Author:** ![TWalter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/twalter/32/41239_2.png) [@TWalter](https://discuss.elastic.co/u/TWalter)\
**Post date:** [September 19, 2016, 7:49am UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/3 "2016-09-19T07:49:30Z")

</div>

Thanks for the fast reply. But sadly i don't look for that.

I study Elasticsearch for my Bachelor Thesis and want to look inside the architecture.  
I want to understand, why i can search for this field even though \_source and doc\_values is deactivated.

Maybe there's something cached or another datatype in the Lucene Index deep in the architecture?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 19, 2016, 8:04am UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/4 "2016-09-19T08:04:54Z")

</div>

Yes. You can search in a field when the field is indexed. Which is the default behavior.

---

<div class="post-metadata">

**Author:** ![TWalter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/twalter/32/41239_2.png) [@TWalter](https://discuss.elastic.co/u/TWalter)\
**Post date:** [September 19, 2016, 12:20pm UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/5 "2016-09-19T12:20:47Z")

</div>

Do you mean indexed in the inverted Index ?

I thought only strings will be stored in the inverted Index and digits (integers, longs) are not stored in this datatype.

Am i wrong?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 19, 2016, 12:39pm UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/6 "2016-09-19T12:39:13Z")

</div>

Not sure about what you mean. May be others can comment.

But basically, if you need to:

- search, you have to index the field (whatever his type)
- compute aggregations, you need to have doc values
- get the original field content (either store the field or get the content from the default `_source` field).

---

<div class="post-metadata">

**Author:** ![TWalter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/twalter/32/41239_2.png) [@TWalter](https://discuss.elastic.co/u/TWalter)\
**Post date:** [September 19, 2016, 1:02pm UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/7 "2016-09-19T13:02:58Z")

</div>

Okay,

point 2 and 3 are absolutely clear for me.

I understood, that we have in one shard (lucene index) three datatypes:

- the inverted index (There are the terms of a string with the location and document, which contains this term)
- the \_source (Here you can find the original JSON-Form of the document)
- doc\_values (Original data of a document in a column-oriented fashion)

And i thought that the inverted index is only for strings and not for the other types. Every example in the internet is without a integer or something else.

See: [https://www.elastic.co/guide/en/elasticsearch/guide/current/inverted-index.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/inverted-index.html)

And the precise Question is now: When i deactivate \_source and doc\_values for a field with an integer (for instance the field "bytes"), is it also stored in the "inverted index"?

If this is true, it makes sense that i can filter documents with a specific number of "bytes" without \_source and doc\_value.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 19, 2016, 1:16pm UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/8 "2016-09-19T13:16:22Z")

</div>

> [@TWalter](#):
>
> And the precise Question is now: When i deactivate source and docvalues for a field with an integer (for instance the field "bytes"), is it also stored in the "inverted index"?

Yes. Not stored but indexed in the inverted index to be exact.

---

<div class="post-metadata">

**Author:** ![TWalter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/twalter/32/41239_2.png) [@TWalter](https://discuss.elastic.co/u/TWalter)\
**Post date:** [September 19, 2016, 1:35pm UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/9 "2016-09-19T13:35:01Z")

</div>

Ahh okay =) Thanks a lot! 😉

That's not mentioned in the documentation of elastic, precisely.

Thanks and have a nice day! =)

---

<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, 10:19pm UTC](https://discuss.elastic.co/t/deactivate--source-and-doc-values-but-can-still-be-queried/60839/10 "2017-07-05T22:19:09Z")

</div>


