# Dynamically setting fields to not be indexed

**URL:** <https://discuss.elastic.co/t/dynamically-setting-fields-to-not-be-indexed/8528>\
**Category:** Elasticsearch\
**Created:** [July 26, 2012, 6:01pm UTC](https://discuss.elastic.co/t/dynamically-setting-fields-to-not-be-indexed/8528 "2012-07-26T18:01:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 26, 2012, 6:01pm UTC](https://discuss.elastic.co/t/dynamically-setting-fields-to-not-be-indexed/8528/1 "2012-07-26T18:01:38Z")

</div>

My current schema contains numerous fields that are used only for the  
display purposes. It would be more efficient for them not to be  
indexed. Source is enabled, so these fields should be set to  
"index":"no"/"store":"no". Instead of setting the index property for  
each field, to "no", I created a dynamic template. This method seems  
not to be working since all fields are still indexed.

My mapping: [https://gist.github.com/b3e3cb20b3dce17309fa](https://gist.github.com/b3e3cb20b3dce17309fa)

Explicitly setting each field not to be index appears to work, but I  
would prefer to have a cleaner mapping template. In other words, I  
would like to override the default for the index property.

Cheers,

Ivan

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 26, 2012, 8:13pm UTC](https://discuss.elastic.co/t/dynamically-setting-fields-to-not-be-indexed/8528/2 "2012-07-26T20:13:34Z")

</div>

One quick additional question: are numbers indexed in Elasticsearch?  
There is a setting for "index", but from what I can tell, numbers are  
stored as binary fields, which are not indexed in Lucene.

On Thu, Jul 26, 2012 at 11:01 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> My current schema contains numerous fields that are used only for the  
> display purposes. It would be more efficient for them not to be  
> indexed. Source is enabled, so these fields should be set to  
> "index":"no"/"store":"no". Instead of setting the index property for  
> each field, to "no", I created a dynamic template. This method seems  
> not to be working since all fields are still indexed.
> 
> My mapping: [https://gist.github.com/b3e3cb20b3dce17309fa](https://gist.github.com/b3e3cb20b3dce17309fa)
> 
> Explicitly setting each field not to be index appears to work, but I  
> would prefer to have a cleaner mapping template. In other words, I  
> would like to override the default for the index property.
> 
> Cheers,
> 
> Ivan

---

<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, 3:18am UTC](https://discuss.elastic.co/t/dynamically-setting-fields-to-not-be-indexed/8528/3 "2017-07-06T03:18:54Z")

</div>


