# Script with ES

**URL:** <https://discuss.elastic.co/t/script-with-es/7377>\
**Category:** Elasticsearch\
**Created:** [April 18, 2012, 10:42am UTC](https://discuss.elastic.co/t/script-with-es/7377 "2012-04-18T10:42:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jerome](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@Jerome](https://discuss.elastic.co/u/Jerome)\
**Post date:** [April 18, 2012, 10:42am UTC](https://discuss.elastic.co/t/script-with-es/7377/1 "2012-04-18T10:42:48Z")

</div>

Hi,

Someone can explain me how i can built a script for adding new field  
with the update function. I don' know mvel and how it works.

If you know an other method to add a new field without reindex and use  
the update method you can ^^

Thanks !

---

<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:** [April 19, 2012, 2:39pm UTC](https://discuss.elastic.co/t/script-with-es/7377/2 "2012-04-19T14:39:52Z")

</div>

First, you can always do a get to the document, add the field to the source  
doc you get back, and reindex it. Using update, see this:  
[https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/FEPueLnG-mM](https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/FEPueLnG-mM)  
.

On Wed, Apr 18, 2012 at 1:42 PM, Jérome [pivertjerome@gmail.com](mailto:pivertjerome@gmail.com) wrote:

> Hi,
> 
> Someone can explain me how i can built a script for adding new field  
> with the update function. I don' know mvel and how it works.
> 
> If you know an other method to add a new field without reindex and use  
> the update method you can ^^
> 
> Thanks !

---

<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:31am UTC](https://discuss.elastic.co/t/script-with-es/7377/3 "2017-07-06T03:31:55Z")

</div>


