# Use arrays as update parameters with elasticsearch-hadoop-mr

**URL:** https://discuss.elastic.co/t/use-arrays-as-update-parameters-with-elasticsearch-hadoop-mr/18470
**Category:** Elasticsearch
**Created:** [July 3, 2014, 5:58pm UTC](https://discuss.elastic.co/t/use-arrays-as-update-parameters-with-elasticsearch-hadoop-mr/18470 "2014-07-03T17:58:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![James\_Campbell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_campbell/32/1411_2.png) [@James\_Campbell](https://discuss.elastic.co/u/James_Campbell)
#### Post date: [July 3, 2014, 5:58pm UTC](https://discuss.elastic.co/t/use-arrays-as-update-parameters-with-elasticsearch-hadoop-mr/18470/1 "2014-07-03T17:58:11Z")

</div>

I would like to update an existing document that has an array from  
elasticsearch hadoop.

I notice that I can do that from curl directly, for example:

PUT arraydemo/temp/1  
{  
"counter" : 1,  
"tags" : ["I am an array", "With Multiple values"],  
"more\_tags" : ["I am a tag"],  
"even\_more\_tags": "I am a tag too!"  
}

GET arraydemo/temp/1

POST arraydemo/temp/1/\_update  
{  
"script" : "tmp = new HashSet(); tmp.addAll(ctx.\_source.tags); tmp.addAll(new\_tags); ctx.\_source.tags = tmp.toArray()",  
"params" : {  
"new\_tags" : ["add me", "and me"]  
}  
}

However, elasticsearch-hadoop appears to be unable to parse array  
parameters, such that an upsert operation from within elasticsearch hadoop  
using the same script and a document with the same JSON for parameters  
fails.

I created an issue on github (elasticsearch hadoop (#223)), but thought I  
should post here for ideas or in case there's a workaround that someone  
might know of.

James Campbell

--  
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/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)
#### Post date: [July 6, 2014, 8:41pm UTC](https://discuss.elastic.co/t/use-arrays-as-update-parameters-with-elasticsearch-hadoop-mr/18470/2 "2014-07-06T20:41:13Z")

</div>

Hi James,

Fwiw, I plan to address this bug shortly - as you pointed out, the JSON  
array needs to be handled separately before passing its content in.

On Thu, Jul 3, 2014 at 8:58 PM, James Campbell [james.p.campbell@gmail.com](mailto:james.p.campbell@gmail.com)  
wrote:

> I would like to update an existing document that has an array from  
> elasticsearch hadoop.
> 
> I notice that I can do that from curl directly, for example:
> 
> PUT arraydemo/temp/1  
> {  
> "counter" : 1,  
> "tags" : ["I am an array", "With Multiple values"],  
> "more\_tags" : ["I am a tag"],  
> "even\_more\_tags": "I am a tag too!"  
> }
> 
> GET arraydemo/temp/1
> 
> POST arraydemo/temp/1/\_update  
> {  
> "script" : "tmp = new HashSet(); tmp.addAll(ctx.\_source.tags); tmp.addAll(new\_tags); ctx.\_source.tags = tmp.toArray()",  
> "params" : {  
> "new\_tags" : ["add me", "and me"]  
> }  
> }
> 
> However, elasticsearch-hadoop appears to be unable to parse array  
> parameters, such that an upsert operation from within elasticsearch hadoop  
> using the same script and a document with the same JSON for parameters  
> fails.
> 
> I created an issue on github (elasticsearch hadoop (#223)), but thought I  
> should post here for ideas or in case there's a workaround that someone  
> might know of.
> 
> James Campbell
> 
> --  
> 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/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%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/CAJogdmdjfWMk0eKX-PDn7GHhCork0xfryXMTNKsOW9aJs-Gr6g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJogdmdjfWMk0eKX-PDn7GHhCork0xfryXMTNKsOW9aJs-Gr6g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![James\_Campbell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james_campbell/32/1411_2.png) [@James\_Campbell](https://discuss.elastic.co/u/James_Campbell)
#### Post date: [July 7, 2014, 1:11pm UTC](https://discuss.elastic.co/t/use-arrays-as-update-parameters-with-elasticsearch-hadoop-mr/18470/3 "2014-07-07T13:11:42Z")

</div>

Costin--

Great news, thanks for the update!

James

On Sun, Jul 6, 2014 at 4:41 PM, Costin Leau [costin.leau@gmail.com](mailto:costin.leau@gmail.com) wrote:

> Hi James,
> 
> Fwiw, I plan to address this bug shortly - as you pointed out, the JSON  
> array needs to be handled separately before passing its content in.
> 
> On Thu, Jul 3, 2014 at 8:58 PM, James Campbell \<[james.p.campbell@gmail.com](mailto:james.p.campbell@gmail.com)
> 
> > wrote:
> 
> > I would like to update an existing document that has an array from  
> > elasticsearch hadoop.
> > 
> > I notice that I can do that from curl directly, for example:
> > 
> > PUT arraydemo/temp/1  
> > {  
> > "counter" : 1,  
> > "tags" : ["I am an array", "With Multiple values"],  
> > "more\_tags" : ["I am a tag"],  
> > "even\_more\_tags": "I am a tag too!"  
> > }
> > 
> > GET arraydemo/temp/1
> > 
> > POST arraydemo/temp/1/\_update  
> > {  
> > "script" : "tmp = new HashSet(); tmp.addAll(ctx.\_source.tags); tmp.addAll(new\_tags); ctx.\_source.tags = tmp.toArray()",  
> > "params" : {  
> > "new\_tags" : ["add me", "and me"]  
> > }  
> > }
> > 
> > However, elasticsearch-hadoop appears to be unable to parse array  
> > parameters, such that an upsert operation from within elasticsearch hadoop  
> > using the same script and a document with the same JSON for parameters  
> > fails.
> > 
> > I created an issue on github (elasticsearch hadoop (#223)), but thought I  
> > should post here for ideas or in case there's a workaround that someone  
> > might know of.
> > 
> > James Campbell
> > 
> > --  
> > 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/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/70608cbd-5a4d-424e-b04e-6daee8ac0635%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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/M7Z6lp3Yjo0/unsubscribe](https://groups.google.com/d/topic/elasticsearch/M7Z6lp3Yjo0/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/CAJogdmdjfWMk0eKX-PDn7GHhCork0xfryXMTNKsOW9aJs-Gr6g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJogdmdjfWMk0eKX-PDn7GHhCork0xfryXMTNKsOW9aJs-Gr6g%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAJogdmdjfWMk0eKX-PDn7GHhCork0xfryXMTNKsOW9aJs-Gr6g%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAJogdmdjfWMk0eKX-PDn7GHhCork0xfryXMTNKsOW9aJs-Gr6g%40mail.gmail.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/CA%2BAQu3yRuVAP7VC3Ozb6Xjy4uG4v%2By2o%3DwkAKnvfB4YL8U71FQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BAQu3yRuVAP7VC3Ozb6Xjy4uG4v%2By2o%3DwkAKnvfB4YL8U71FQ%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, 1:17am UTC](https://discuss.elastic.co/t/use-arrays-as-update-parameters-with-elasticsearch-hadoop-mr/18470/4 "2017-07-06T01:17:35Z")

</div>


