# Index: false on field vs not mapping field at all

**URL:** <https://discuss.elastic.co/t/index-false-on-field-vs-not-mapping-field-at-all/228006>\
**Category:** Elasticsearch\
**Created:** [April 14, 2020, 10:53pm UTC](https://discuss.elastic.co/t/index-false-on-field-vs-not-mapping-field-at-all/228006 "2020-04-14T22:53:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bern\_ash](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@bern\_ash](https://discuss.elastic.co/u/bern_ash)\
**Post date:** [April 14, 2020, 10:53pm UTC](https://discuss.elastic.co/t/index-false-on-field-vs-not-mapping-field-at-all/228006/1 "2020-04-14T22:53:15Z")

</div>

Hi everyone,

Is there a difference between having a field in my mapping with index: false and simply omitting that field from my mapping (if the mapping has dynamic: false) ?

I'm asking this because I have many fields in my source documents that I don't want to search or aggregate on and looking to optimize for index size and search speed...

Thanks !  
B

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 14, 2020, 11:14pm UTC](https://discuss.elastic.co/t/index-false-on-field-vs-not-mapping-field-at-all/228006/2 "2020-04-14T23:14:47Z")

</div>

Hello @bern_ash

**Setting `dynamic: false`**

- The field will not be mentioned at all in the mappings (smaller mappings)
- You "protect" your indices from several unwanted fields
- The field will still be in the `_source`
- Searching for unmapped fields will raise no error.

**Setting `index: false`**

- It still requires to specify a `type`, so you can validate your data
- Searching for a mapped field with `index: false` will raise an exception

You could think of disabling the `_source` ([doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html)), but it has drawbacks.

Some tips about storage optimizations are available in our [doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-disk-usage.html).

---

<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:** [May 12, 2020, 11:15pm UTC](https://discuss.elastic.co/t/index-false-on-field-vs-not-mapping-field-at-all/228006/3 "2020-05-12T23:15:00Z")

</div>

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