# Dynamic template does not apply to existing fields

**URL:** <https://discuss.elastic.co/t/dynamic-template-does-not-apply-to-existing-fields/8015>\
**Category:** Elasticsearch\
**Created:** [June 8, 2012, 3:13am UTC](https://discuss.elastic.co/t/dynamic-template-does-not-apply-to-existing-fields/8015 "2012-06-08T03:13:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ywtsang](https://avatars.discourse-cdn.com/v4/letter/y/a698b9/32.png) [@ywtsang](https://discuss.elastic.co/u/ywtsang)\
**Post date:** [June 8, 2012, 3:13am UTC](https://discuss.elastic.co/t/dynamic-template-does-not-apply-to-existing-fields/8015/1 "2012-06-08T03:13:56Z")

</div>

I have some scanerios of using dynamic template:

1. create a new index and index some records using the default setting

2. apply a new dynamic template on some of existing fields using the  
put mapping API  
some details about my dynamic template:

3. 

a) reindex the existing records and the existing matched fields  
don't have the dynamic template applied  
b) index some new records and the matched fields still cannot have  
the dynamic template applied  
c) reindex the records, but just slightly change the field name (but  
matched with the dynamic template) and now the fields can have the  
dynamic template applied

So, the dynamic template cannot change the existing fields?

Thanks,  
Wing

---

<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:** [June 8, 2012, 5:42pm UTC](https://discuss.elastic.co/t/dynamic-template-does-not-apply-to-existing-fields/8015/2 "2012-06-08T17:42:41Z")

</div>

Dynamic template changes only apply to new indices.

--  
Ivan

On Thu, Jun 7, 2012 at 8:13 PM, Yiu Wing TSANG [ywtsang@gmail.com](mailto:ywtsang@gmail.com) wrote:

> I have some scanerios of using dynamic template:
> 
> 1. create a new index and index some records using the default setting
> 
> 2. apply a new dynamic template on some of existing fields using the  
> put mapping API  
> some details about my dynamic template:
> 
> - type is "multi\_field"
> - match is some regex
> - i.e. very similar to this:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/root-object-type.html)  
> -\> dynamic\_templates
> 
> 1. 
> 
> a) reindex the existing records and the existing matched fields  
> don't have the dynamic template applied  
> b) index some new records and the matched fields still cannot have  
> the dynamic template applied  
> c) reindex the records, but just slightly change the field name (but  
> matched with the dynamic template) and now the fields can have the  
> dynamic template applied
> 
> So, the dynamic template cannot change the existing fields?
> 
> Thanks,  
> Wing

---

<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:25am UTC](https://discuss.elastic.co/t/dynamic-template-does-not-apply-to-existing-fields/8015/3 "2017-07-06T03:25:10Z")

</div>


