# Index update script

**URL:** <https://discuss.elastic.co/t/index-update-script/8453>\
**Category:** Elasticsearch\
**Created:** [July 18, 2012, 5:36pm UTC](https://discuss.elastic.co/t/index-update-script/8453 "2012-07-18T17:36:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinicius\_Carvalho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinicius_carvalho/32/770_2.png) [@Vinicius\_Carvalho](https://discuss.elastic.co/u/Vinicius_Carvalho)\
**Post date:** [July 18, 2012, 5:36pm UTC](https://discuss.elastic.co/t/index-update-script/8453/1 "2012-07-18T17:36:54Z")

</div>

Is it possible to update the whole index using a script? Let me give an  
example:

on my curent index I have a mapping:

{  
"name" : "string"  
}

I'd like to include an extra field on every document, called auto\_complete,  
and have the name field stored there, but using a different analyzer  
(EdgeNGram for instance), so I can change the mapping, and later run a  
single script to do that.

I know I could just go over the api and do doc by doc, just trying to  
understand if there's an easier way around.

Regards

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 18, 2012, 8:44pm UTC](https://discuss.elastic.co/t/index-update-script/8453/2 "2012-07-18T20:44:37Z")

</div>

No, there isn't an option to do that in elasticsearch itself. You probably  
are better off simply reindexing the data (from the existing index for  
example), or simply taking into account that some docs will have that field  
missing.

On Wed, Jul 18, 2012 at 10:36 AM, Vinicius Carvalho \<  
[viniciusccarvalho@gmail.com](mailto:viniciusccarvalho@gmail.com)\> wrote:

> Is it possible to update the whole index using a script? Let me give an  
> example:
> 
> on my curent index I have a mapping:
> 
> {  
> "name" : "string"  
> }
> 
> I'd like to include an extra field on every document, called  
> auto\_complete, and have the name field stored there, but using a different  
> analyzer (EdgeNGram for instance), so I can change the mapping, and later  
> run a single script to do that.
> 
> I know I could just go over the api and do doc by doc, just trying to  
> understand if there's an easier way around.
> 
> Regards

---

<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:19am UTC](https://discuss.elastic.co/t/index-update-script/8453/3 "2017-07-06T03:19:55Z")

</div>


