# Updating an array field without a script

**URL:** https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249
**Category:** Elasticsearch
**Created:** [April 15, 2015, 9:32am UTC](https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249 "2015-04-15T09:32:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![redserpent7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redserpent7/32/467_2.png) [@redserpent7](https://discuss.elastic.co/u/redserpent7)
#### Post date: [April 15, 2015, 9:32am UTC](https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249/1 "2015-04-15T09:32:45Z")

</div>

Hi,

I would like to know if there is a way to add or remove from an array field  
without using a script? All the examples I came across use scripts to do  
this, yet I do not want to enable scripts on my cluster (dynamic or  
indexed).

How can I achieve this?

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)
#### Post date: [April 15, 2015, 9:38am UTC](https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249/2 "2015-04-15T09:38:24Z")

</div>

Hi ,

You can place your script under script directory  
[http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html](http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html)  
and use this script without enabling scripting.  
You can find more information on this here  
[http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html](http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html)  
.  
Or you can write a java code which does this and package it as a plugin.  
You can find some examples here  
[https://github.com/imotov/elasticsearch-native-script-example](https://github.com/imotov/elasticsearch-native-script-example).

In both these case , you need to make sure this code/plugin is pushed to  
all the nodes.

Thanks  
Vineeth Mohan,  
Elasticsearch consultant,  
[qbox.io](http://qbox.io) ( Elasticsearch service provider [http://qbox.io/](http://qbox.io/))

On Wed, Apr 15, 2015 at 3:02 PM, Zaid Amir [redserpent7@gmail.com](mailto:redserpent7@gmail.com) wrote:

> Hi,
> 
> I would like to know if there is a way to add or remove from an array  
> field without using a script? All the examples I came across use scripts to  
> do this, yet I do not want to enable scripts on my cluster (dynamic or  
> indexed).
> 
> How can I achieve this?
> 
> Thanks
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5ky5X\_EhobpmeE\_9aJRNRVhzqFpndCVwSV4a874TUdMgw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5ky5X_EhobpmeE_9aJRNRVhzqFpndCVwSV4a874TUdMgw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![redserpent7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redserpent7/32/467_2.png) [@redserpent7](https://discuss.elastic.co/u/redserpent7)
#### Post date: [April 15, 2015, 9:49am UTC](https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249/3 "2015-04-15T09:49:45Z")

</div>

So what you're saying is, there is no way to do this without a script or  
plugin. Is that right?

On Wednesday, April 15, 2015 at 12:38:37 PM UTC+3, vineeth mohan wrote:

> Hi ,
> 
> You can place your script under script directory  
> [http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html](http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html)  
> and use this script without enabling scripting.  
> You can find more information on this here  
> [http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html](http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html)  
> .  
> Or you can write a java code which does this and package it as a plugin.  
> You can find some examples here  
> [https://github.com/imotov/elasticsearch-native-script-example](https://github.com/imotov/elasticsearch-native-script-example).
> 
> In both these case , you need to make sure this code/plugin is pushed to  
> all the nodes.
> 
> Thanks  
> Vineeth Mohan,  
> Elasticsearch consultant,  
> [qbox.io](http://qbox.io) ( Elasticsearch service provider [http://qbox.io/](http://qbox.io/))
> 
> On Wed, Apr 15, 2015 at 3:02 PM, Zaid Amir \<[redse...@gmail.com](mailto:redse...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Hi,
> > 
> > I would like to know if there is a way to add or remove from an array  
> > field without using a script? All the examples I came across use scripts to  
> > do this, yet I do not want to enable scripts on my cluster (dynamic or  
> > indexed).
> > 
> > How can I achieve this?
> > 
> > Thanks
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7ff9786e-c5cf-4ac1-b093-47b3e1c76dc1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7ff9786e-c5cf-4ac1-b093-47b3e1c76dc1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)
#### Post date: [April 15, 2015, 5:23pm UTC](https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249/4 "2015-04-15T17:23:13Z")

</div>

Hello Zaid ,

It seems so.  
But then you can anytime take the document , make the changes and index it  
back to the same docID.  
That does not need any scripting capability.

Thanks  
Vineeth Mohan,  
Elasticsearch consultant,  
[qbox.io](http://qbox.io) ( Elasticsearch service provider [http://qbox.io/](http://qbox.io/))

On Wed, Apr 15, 2015 at 3:19 PM, Zaid Amir [redserpent7@gmail.com](mailto:redserpent7@gmail.com) wrote:

> So what you're saying is, there is no way to do this without a script or  
> plugin. Is that right?
> 
> On Wednesday, April 15, 2015 at 12:38:37 PM UTC+3, vineeth mohan wrote:
> 
> > Hi ,
> > 
> > You can place your script under script directory  
> > [http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html](http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html)  
> > and use this script without enabling scripting.  
> > You can find more information on this here  
> > [http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html](http://www.elastic.co/guide/en/elasticsearch/reference/1.x/modules-scripting.html)  
> > .  
> > Or you can write a java code which does this and package it as a plugin.  
> > You can find some examples here  
> > [https://github.com/imotov/elasticsearch-native-script-example](https://github.com/imotov/elasticsearch-native-script-example).
> > 
> > In both these case , you need to make sure this code/plugin is pushed to  
> > all the nodes.
> > 
> > Thanks  
> > Vineeth Mohan,  
> > Elasticsearch consultant,  
> > [qbox.io](http://qbox.io) ( Elasticsearch service provider [http://qbox.io/](http://qbox.io/))
> > 
> > On Wed, Apr 15, 2015 at 3:02 PM, Zaid Amir [redse...@gmail.com](mailto:redse...@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > I would like to know if there is a way to add or remove from an array  
> > > field without using a script? All the examples I came across use scripts to  
> > > do this, yet I do not want to enable scripts on my cluster (dynamic or  
> > > indexed).
> > > 
> > > How can I achieve this?
> > > 
> > > Thanks
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0afcb38c-43c2-44b3-a967-e4a233a3f65e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/7ff9786e-c5cf-4ac1-b093-47b3e1c76dc1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7ff9786e-c5cf-4ac1-b093-47b3e1c76dc1%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/7ff9786e-c5cf-4ac1-b093-47b3e1c76dc1%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/7ff9786e-c5cf-4ac1-b093-47b3e1c76dc1%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DNiP%3Dc2pbavkp7sQbdsAt7V7\_GS%3DbsREcF5%3D%3D9EJowKg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3DNiP%3Dc2pbavkp7sQbdsAt7V7_GS%3DbsREcF5%3D%3D9EJowKg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:19am UTC](https://discuss.elastic.co/t/updating-an-array-field-without-a-script/23249/5 "2017-07-06T00:19:31Z")

</div>


