# Update API Problem

**URL:** https://discuss.elastic.co/t/update-api-problem/11392
**Category:** Elasticsearch
**Created:** [March 30, 2013, 1:58pm UTC](https://discuss.elastic.co/t/update-api-problem/11392 "2013-03-30T13:58:05Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![okhafi](https://avatars.discourse-cdn.com/v4/letter/o/e8c25b/32.png) [@okhafi](https://discuss.elastic.co/u/okhafi)
#### Post date: [March 30, 2013, 1:58pm UTC](https://discuss.elastic.co/t/update-api-problem/11392/1 "2013-03-30T13:58:05Z")

</div>

Hello,  
I'm new to elasticsearch. testing logstash,redis,elasticsearch and kibana.  
Version - _elasticsearch-0.20.5_.

For now, I'm doing this operations:

1. I'm searching specific messages with elastic api.
2. Sending email with the results.
3. Taking index,id,type and trying to update the document and add a new tag  
named "reported".

Running curl through php:  
\*  
[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-type/vG2dLak5TXSzW1jKlitOGg/\_update](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-type/vG2dLak5TXSzW1jKlitOGg/_update)  
\*  
POST data is: array("script" =\> "ctx.\_source.tags += tag", "params" =\>  
array("tag" =\> "reported"))\* - this is encoded to json, looks same as the  
documentation,\*

I'm getting this  
error {"error":"ElasticSearchIllegalArgumentException[failed to execute  
script]; nested: PropertyAccessException[[Error: could not access: tags; in  
class: java.util.LinkedHashMap]\n[Near : {... ctx.\_source.tags+tag ....}]\n  
^\n[Line: 1, Column: 1]]; ","status":400}

I'm probably missing something, any ideas?  
Thanks in advance,  
Or

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![okhafi](https://avatars.discourse-cdn.com/v4/letter/o/e8c25b/32.png) [@okhafi](https://discuss.elastic.co/u/okhafi)
#### Post date: [April 2, 2013, 6:24am UTC](https://discuss.elastic.co/t/update-api-problem/11392/2 "2013-04-02T06:24:06Z")

</div>

Should I open a bug?

On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:

> Hello,  
> I'm new to elasticsearch. testing logstash,redis,elasticsearch and kibana.  
> Version - _elasticsearch-0.20.5_.
> 
> For now, I'm doing this operations:
> 
> 1. I'm searching specific messages with elastic api.
> 2. Sending email with the results.
> 3. Taking index,id,type and trying to update the document and add a new  
> tag named "reported".
> 
> Running curl through php:  
> \*  
> [http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-type/vG2dLak5TXSzW1jKlitOGg/\_update](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-type/vG2dLak5TXSzW1jKlitOGg/_update)  
> \*  
> POST data is: array("script" =\> "ctx.\_source.tags += tag", "params" =\>  
> array("tag" =\> "reported"))\* - this is encoded to json, looks same as the  
> documentation,\*
> 
> I'm getting this  
> error {"error":"ElasticSearchIllegalArgumentException[failed to execute  
> script]; nested: PropertyAccessException[[Error: could not access: tags; in  
> class: java.util.LinkedHashMap]\n[Near : {... ctx.\_source.tags+tag ....}]\n  
> ^\n[Line: 1, Column: 1]]; ","status":400}
> 
> I'm probably missing something, any ideas?  
> Thanks in advance,  
> Or

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [April 2, 2013, 6:29am UTC](https://discuss.elastic.co/t/update-api-problem/11392/3 "2013-04-02T06:29:55Z")

</div>

Hey,

can you provide the real JSON used in the request - just to make sure there  
are no strange errors leading to this exception? Also can you check the  
logs for a more verbose logging?

--Alex

On Tue, Apr 2, 2013 at 8:24 AM, [okhafi@gmail.com](mailto:okhafi@gmail.com) wrote:

> Should I open a bug?
> 
> On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> 
> > Hello,  
> > I'm new to elasticsearch. testing logstash,redis,elasticsearch and kibana.  
> > Version - _elasticsearch-0.20.5_.
> > 
> > For now, I'm doing this operations:
> > 
> > 1. I'm searching specific messages with elastic api.
> > 2. Sending email with the results.
> > 3. Taking index,id,type and trying to update the document and add a new  
> > tag named "reported".
> > 
> > Running curl through php:  
> > _[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-)  
> > type/vG2dLak5TXSzW1jKlitOGg/\_update_  
> > POST data is: array("script" =\> "ctx.\_source.tags += tag", "params" =\>  
> > array("tag" =\> "reported"))\* - this is encoded to json, looks same as  
> > the documentation,\*
> > 
> > I'm getting this error {"error":" **ElasticSearchIllegalArgumentEx** ception[failed  
> > to execute script]; nested: PropertyAccessException[[\*\*Error: could not  
> > access: tags; in class: java.util.LinkedHashMap]\n[\*\*Near : {...  
> > ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > ","status":400}
> > 
> > I'm probably missing something, any ideas?  
> > Thanks in advance,  
> > Or
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![okhafi](https://avatars.discourse-cdn.com/v4/letter/o/e8c25b/32.png) [@okhafi](https://discuss.elastic.co/u/okhafi)
#### Post date: [April 2, 2013, 10:49am UTC](https://discuss.elastic.co/t/update-api-problem/11392/4 "2013-04-02T10:49:05Z")

</div>

curl -XPOST  
'localhost:9200/logstash-2013.03.28/xxxxx\_log-type/qWtE27BWQuCsjBWUxoCxdg/\_update'  
-d '{  
"script" : "ctx.\_source.tags += tag",  
"params" : {  
"tag" : "reported"  
}  
}'

Execption:  
{"error":"ElasticSearchIllegalArgumentException[failed to execute script];  
nested: PropertyAccessException[[Error: could not access: tags; in class:  
java.util.LinkedHashMap]\n[Near : {... ctx.\_source.tags+tag ....}]\n  
^\n[Line: 1, Column: 1]]; ","status":400}

On Tuesday, April 2, 2013 9:29:55 AM UTC+3, Alexander Reelsen wrote:

> Hey,
> 
> can you provide the real JSON used in the request - just to make sure  
> there are no strange errors leading to this exception? Also can you check  
> the logs for a more verbose logging?
> 
> --Alex
> 
> On Tue, Apr 2, 2013 at 8:24 AM, \<[okh...@gmail.com](mailto:okh...@gmail.com) \<javascript:\>\> wrote:
> 
> > Should I open a bug?
> > 
> > On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > 
> > > Hello,  
> > > I'm new to elasticsearch. testing logstash,redis,elasticsearch and  
> > > kibana.  
> > > Version - _elasticsearch-0.20.5_.
> > > 
> > > For now, I'm doing this operations:
> > > 
> > > 1. I'm searching specific messages with elastic api.
> > > 2. Sending email with the results.
> > > 3. Taking index,id,type and trying to update the document and add a new  
> > > tag named "reported".
> > > 
> > > Running curl through php:  
> > > _[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-)  
> > > type/vG2dLak5TXSzW1jKlitOGg/\_update_  
> > > POST data is: array("script" =\> "ctx.\_source.tags += tag", "params" =\>  
> > > array("tag" =\> "reported"))\* - this is encoded to json, looks same as  
> > > the documentation,\*
> > > 
> > > I'm getting this error {"error":" **ElasticSearchIllegalArgumentEx** ception[failed  
> > > to execute script]; nested: PropertyAccessException[[\*\*Error: could not  
> > > access: tags; in class: java.util.LinkedHashMap]\n[\*\*Near : {...  
> > > ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > > ","status":400}
> > > 
> > > I'm probably missing something, any ideas?  
> > > Thanks in advance,  
> > > Or
> > 
> > --  
> > 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:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [April 2, 2013, 10:54am UTC](https://discuss.elastic.co/t/update-api-problem/11392/5 "2013-04-02T10:54:00Z")

</div>

Hey,

curl -X PUT localhost:9200/foo/bar/1 -d '{ "tags": ["a","b"] }'  
curl -X POST localhost:9200/foo/bar/1/\_update -d '{ "script" :  
"ctx.\_source.tags += tag", "params" : { "tag" : "reported" } }'  
curl localhost:9200/foo/bar/1  
{"\_index":"foo","\_type":"bar","\_id":"1","\_version":4,"exists":true,  
"\_source" : {"tags":["a","b","reported"]}}

looks ok, with a local test.. can you show the source of the document you  
are trying to update?

--Alex

On Tue, Apr 2, 2013 at 12:49 PM, [okhafi@gmail.com](mailto:okhafi@gmail.com) wrote:

> curl -XPOST  
> 'localhost:9200/logstash-2013.03.28/xxxxx\_log-type/qWtE27BWQuCsjBWUxoCxdg/\_update'  
> -d '{  
> "script" : "ctx.\_source.tags += tag",  
> "params" : {  
> "tag" : "reported"  
> }  
> }'
> 
> Execption:  
> {"error":"ElasticSearchIllegalArgumentException[failed to execute script];  
> nested: PropertyAccessException[[Error: could not access: tags; in class:  
> java.util.LinkedHashMap]\n[Near : {... ctx.\_source.tags+tag ....}]\n  
> ^\n[Line: 1, Column: 1]]; ","status":400}
> 
> On Tuesday, April 2, 2013 9:29:55 AM UTC+3, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > can you provide the real JSON used in the request - just to make sure  
> > there are no strange errors leading to this exception? Also can you check  
> > the logs for a more verbose logging?
> > 
> > --Alex
> > 
> > On Tue, Apr 2, 2013 at 8:24 AM, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > 
> > > Should I open a bug?
> > > 
> > > On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > 
> > > > Hello,  
> > > > I'm new to elasticsearch. testing logstash,redis,elasticsearch and  
> > > > kibana.  
> > > > Version - _elasticsearch-0.20.5_.
> > > > 
> > > > For now, I'm doing this operations:
> > > > 
> > > > 1. I'm searching specific messages with elastic api.
> > > > 2. Sending email with the results.
> > > > 3. Taking index,id,type and trying to update the document and add a new  
> > > > tag named "reported".
> > > > 
> > > > Running curl through php:  
> > > > _[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-type/](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-type/)  
> > > > vG2dLak5TXSzW1jKlitOGg/\_update_  
> > > > POST data is: array("script" =\> "ctx.\_source.tags += tag", "params" =\>  
> > > > array("tag" =\> "reported"))\* - this is encoded to json, looks same as  
> > > > the documentation,\*
> > > > 
> > > > I'm getting this error {"error":" **ElasticSearchI** llegalArgumentEx\*\*ception[failed  
> > > > to execute script]; nested: PropertyAccessException[[ **Error** : could  
> > > > not access: tags; in class: java.util.LinkedHashMap]\n[ **Nea** r : {...  
> > > > ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > > > ","status":400}
> > > > 
> > > > I'm probably missing something, any ideas?  
> > > > Thanks in advance,  
> > > > Or
> > > 
> > > --  
> > > 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](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![okhafi](https://avatars.discourse-cdn.com/v4/letter/o/e8c25b/32.png) [@okhafi](https://discuss.elastic.co/u/okhafi)
#### Post date: [April 2, 2013, 11:55am UTC](https://discuss.elastic.co/t/update-api-problem/11392/6 "2013-04-02T11:55:00Z")

</div>

Hey,

{"\_index":"logstash-2013.03.28","\_type":"xxxxx\_log-type","\_id":"qWtE27BWQuCsjBWUxoCxdg","\_version":1,"exists":true,  
"\_source" :

The source is an exception and has some _\n_ in it...

Thanks,  
Or

On Tuesday, April 2, 2013 1:54:00 PM UTC+3, Alexander Reelsen wrote:

> Hey,
> 
> curl -X PUT localhost:9200/foo/bar/1 -d '{ "tags": ["a","b"] }'  
> curl -X POST localhost:9200/foo/bar/1/\_update -d '{ "script" :  
> "ctx.\_source.tags += tag", "params" : { "tag" : "reported" } }'  
> curl localhost:9200/foo/bar/1  
> {"\_index":"foo","\_type":"bar","\_id":"1","\_version":4,"exists":true,  
> "\_source" : {"tags":["a","b","reported"]}}
> 
> looks ok, with a local test.. can you show the source of the document you  
> are trying to update?
> 
> --Alex
> 
> On Tue, Apr 2, 2013 at 12:49 PM, \<[okh...@gmail.com](mailto:okh...@gmail.com) \<javascript:\>\> wrote:
> 
> > curl -XPOST  
> > 'localhost:9200/logstash-2013.03.28/xxxxx\_log-type/qWtE27BWQuCsjBWUxoCxdg/\_update'  
> > -d '{  
> > "script" : "ctx.\_source.tags += tag",  
> > "params" : {  
> > "tag" : "reported"  
> > }  
> > }'
> > 
> > Execption:  
> > {"error":"ElasticSearchIllegalArgumentException[failed to execute  
> > script]; nested: PropertyAccessException[[Error: could not access: tags; in  
> > class: java.util.LinkedHashMap]\n[Near : {... ctx.\_source.tags+tag ....}]\n  
> > ^\n[Line: 1, Column: 1]]; ","status":400}
> > 
> > On Tuesday, April 2, 2013 9:29:55 AM UTC+3, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > can you provide the real JSON used in the request - just to make sure  
> > > there are no strange errors leading to this exception? Also can you check  
> > > the logs for a more verbose logging?
> > > 
> > > --Alex
> > > 
> > > On Tue, Apr 2, 2013 at 8:24 AM, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > 
> > > > Should I open a bug?
> > > > 
> > > > On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > > 
> > > > > Hello,  
> > > > > I'm new to elasticsearch. testing logstash,redis,elasticsearch and  
> > > > > kibana.  
> > > > > Version - _elasticsearch-0.20.5_.
> > > > > 
> > > > > For now, I'm doing this operations:
> > > > > 
> > > > > 1. I'm searching specific messages with elastic api.
> > > > > 2. Sending email with the results.
> > > > > 3. Taking index,id,type and trying to update the document and add a  
> > > > > new tag named "reported".
> > > > > 
> > > > > Running curl through php:  
> > > > > _[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-type/](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-type/)  
> > > > > vG2dLak5TXSzW1jKlitOGg/\_update_  
> > > > > POST data is: array("script" =\> "ctx.\_source.tags += tag", "params" =\>  
> > > > > array("tag" =\> "reported"))\* - this is encoded to json, looks same as  
> > > > > the documentation,\*
> > > > > 
> > > > > I'm getting this error {"error":" **ElasticSearchI** llegalArgumentEx\*\*ception[failed  
> > > > > to execute script]; nested: PropertyAccessException[[ **Error** : could  
> > > > > not access: tags; in class: java.util.LinkedHashMap]\n[ **Nea** r :  
> > > > > {... ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > > > > ","status":400}
> > > > > 
> > > > > I'm probably missing something, any ideas?  
> > > > > Thanks in advance,  
> > > > > Or
> > > > 
> > > > --  
> > > > 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](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > 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:\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![okhafi](https://avatars.discourse-cdn.com/v4/letter/o/e8c25b/32.png) [@okhafi](https://discuss.elastic.co/u/okhafi)
#### Post date: [April 3, 2013, 12:57pm UTC](https://discuss.elastic.co/t/update-api-problem/11392/7 "2013-04-03T12:57:49Z")

</div>

Hey,  
For now I just added a new field instead of tag.  
Let me know if you need any information from me to resolve it.  
Or

On Tuesday, April 2, 2013 2:55:00 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:

> Hey,
> 
> {"\_index":"logstash-2013.03.28","\_type":"xxxxx\_log-type","\_id":"qWtE27BWQuCsjBWUxoCxdg","\_version":1,"exists":true,  
> "\_source" :
> 
> The source is an exception and has some _\n_ in it...
> 
> Thanks,  
> Or
> 
> On Tuesday, April 2, 2013 1:54:00 PM UTC+3, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > curl -X PUT localhost:9200/foo/bar/1 -d '{ "tags": ["a","b"] }'  
> > curl -X POST localhost:9200/foo/bar/1/\_update -d '{ "script" :  
> > "ctx.\_source.tags += tag", "params" : { "tag" : "reported" } }'  
> > curl localhost:9200/foo/bar/1  
> > {"\_index":"foo","\_type":"bar","\_id":"1","\_version":4,"exists":true,  
> > "\_source" : {"tags":["a","b","reported"]}}
> > 
> > looks ok, with a local test.. can you show the source of the document you  
> > are trying to update?
> > 
> > --Alex
> > 
> > On Tue, Apr 2, 2013 at 12:49 PM, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > 
> > > curl -XPOST  
> > > 'localhost:9200/logstash-2013.03.28/xxxxx\_log-type/qWtE27BWQuCsjBWUxoCxdg/\_update'  
> > > -d '{  
> > > "script" : "ctx.\_source.tags += tag",  
> > > "params" : {  
> > > "tag" : "reported"  
> > > }  
> > > }'
> > > 
> > > Execption:  
> > > {"error":"ElasticSearchIllegalArgumentException[failed to execute  
> > > script]; nested: PropertyAccessException[[Error: could not access: tags; in  
> > > class: java.util.LinkedHashMap]\n[Near : {... ctx.\_source.tags+tag ....}]\n  
> > > ^\n[Line: 1, Column: 1]]; ","status":400}
> > > 
> > > On Tuesday, April 2, 2013 9:29:55 AM UTC+3, Alexander Reelsen wrote:
> > > 
> > > > Hey,
> > > > 
> > > > can you provide the real JSON used in the request - just to make sure  
> > > > there are no strange errors leading to this exception? Also can you check  
> > > > the logs for a more verbose logging?
> > > > 
> > > > --Alex
> > > > 
> > > > On Tue, Apr 2, 2013 at 8:24 AM, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > > 
> > > > > Should I open a bug?
> > > > > 
> > > > > On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > > > 
> > > > > > Hello,  
> > > > > > I'm new to elasticsearch. testing logstash,redis,elasticsearch and  
> > > > > > kibana.  
> > > > > > Version - _elasticsearch-0.20.5_.
> > > > > > 
> > > > > > For now, I'm doing this operations:
> > > > > > 
> > > > > > 1. I'm searching specific messages with elastic api.
> > > > > > 2. Sending email with the results.
> > > > > > 3. Taking index,id,type and trying to update the document and add a  
> > > > > > new tag named "reported".
> > > > > > 
> > > > > > Running curl through php:  
> > > > > > _[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-type/](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-type/)  
> > > > > > vG2dLak5TXSzW1jKlitOGg/\_update_  
> > > > > > POST data is: array("script" =\> "ctx.\_source.tags += tag", "params"  
> > > > > > =\> array("tag" =\> "reported"))\* - this is encoded to json, looks  
> > > > > > same as the documentation,\*
> > > > > > 
> > > > > > I'm getting this error {"error":" **ElasticSearchI** llegalArgumentEx\*\*ception[failed  
> > > > > > to execute script]; nested: PropertyAccessException[[ **Error** :  
> > > > > > could not access: tags; in class: java.util.LinkedHashMap]\n[ **Nea** r  
> > > > > > : {... ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > > > > > ","status":400}
> > > > > > 
> > > > > > I'm probably missing something, any ideas?  
> > > > > > Thanks in advance,  
> > > > > > Or
> > > > > 
> > > > > --  
> > > > > 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](http://googlegroups.com).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > .
> > > > 
> > > > --  
> > > > 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).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [April 4, 2013, 6:36am UTC](https://discuss.elastic.co/t/update-api-problem/11392/8 "2013-04-04T06:36:17Z")

</div>

Hey,

can you put everything in a gist, so we get some more background information

a) the document (the result of a GET operation)  
b) your index mapping  
c) Your update query

include all exceptions and logs as well please...

--Alex

On Wed, Apr 3, 2013 at 2:57 PM, [okhafi@gmail.com](mailto:okhafi@gmail.com) wrote:

> Hey,  
> For now I just added a new field instead of tag.  
> Let me know if you need any information from me to resolve it.  
> Or
> 
> On Tuesday, April 2, 2013 2:55:00 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> 
> > Hey,
> > 
> > {"\_index":"logstash-2013.03. **28","\_type":"xxxxx\_log-type","**  
> > \_id":"qWtE27BWQuCsjBWUxoCxdg",\*\*"\_version":1,"exists":true, "\_source" :
> > 
> > The source is an exception and has some _\n_ in it...
> > 
> > Thanks,  
> > Or
> > 
> > On Tuesday, April 2, 2013 1:54:00 PM UTC+3, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > curl -X PUT localhost:9200/foo/bar/1 -d '{ "tags": ["a","b"] }'  
> > > curl -X POST localhost:9200/foo/bar/1/\_**update -d '{ "script" :  
> > > "ctx.\_source.tags += tag", "params" : { "tag" : "reported" } }'  
> > > curl localhost:9200/foo/bar/1  
> > > {"\_index":"foo","\_type":"bar",**"\_id":"1","\_version":4,"\*\*exists":true,  
> > > "\_source" : {"tags":["a","b","reported"]}}
> > > 
> > > looks ok, with a local test.. can you show the source of the document  
> > > you are trying to update?
> > > 
> > > --Alex
> > > 
> > > On Tue, Apr 2, 2013 at 12:49 PM, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > 
> > > > curl -XPOST 'localhost:9200/logstash-2013. **03.28/xxxxx\_log-type/**  
> > > > qWtE27BWQuCsjBWUxoCxdg/\_\*\*update' -d '{  
> > > > "script" : "ctx.\_source.tags += tag",  
> > > > "params" : {  
> > > > "tag" : "reported"  
> > > > }  
> > > > }'
> > > > 
> > > > Execption:  
> > > > {"error":" **ElasticSearchIllegalArgumentEx** ception[failed to execute  
> > > > script]; nested: PropertyAccessException[[\*\*Error: could not access:  
> > > > tags; in class: java.util.LinkedHashMap]\n[\*\*Near : {...  
> > > > ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > > > ","status":400}
> > > > 
> > > > On Tuesday, April 2, 2013 9:29:55 AM UTC+3, Alexander Reelsen wrote:
> > > > 
> > > > > Hey,
> > > > > 
> > > > > can you provide the real JSON used in the request - just to make sure  
> > > > > there are no strange errors leading to this exception? Also can you check  
> > > > > the logs for a more verbose logging?
> > > > > 
> > > > > --Alex
> > > > > 
> > > > > On Tue, Apr 2, 2013 at 8:24 AM, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > > > 
> > > > > > Should I open a bug?
> > > > > > 
> > > > > > On Saturday, March 30, 2013 4:58:05 PM UTC+3, [okh...@gmail.com](mailto:okh...@gmail.com) wrote:
> > > > > > 
> > > > > > > Hello,  
> > > > > > > I'm new to elasticsearch. testing logstash,redis,elasticsearch and  
> > > > > > > kibana.  
> > > > > > > Version - _elasticsearch-0.20.5_.
> > > > > > > 
> > > > > > > For now, I'm doing this operations:
> > > > > > > 
> > > > > > > 1. I'm searching specific messages with elastic api.
> > > > > > > 2. Sending email with the results.
> > > > > > > 3. Taking index,id,type and trying to update the document and add a  
> > > > > > > new tag named "reported".
> > > > > > > 
> > > > > > > Running curl through php:  
> > > > > > > _[http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx\_log-type/vG2](http://xxx.xxx.xxx:9200/logstash-2013.03.27/xxx_log-type/vG2)  
> > > > > > > dLak5TXSzW1jKlitOGg/\_update_  
> > > > > > > POST data is: array("script" =\> "ctx.\_source.tags += tag", "params"  
> > > > > > > =\> array("tag" =\> "reported"))\* - this is encoded to json, looks  
> > > > > > > same as the documentation,\*
> > > > > > > 
> > > > > > > I'm getting this error {"error":" **ElasticSearchI** \*\*  
> > > > > > > llegalArgumentEx\*\*ception[failed to execute script]; nested:  
> > > > > > > PropertyAccessException[[ **Error** \*\*: could not access: tags; in  
> > > > > > > class: java.util.LinkedHashMap]\n[\*\*Nea\*\*\*\*r : {...  
> > > > > > > ctx.\_source.tags+tag ....}]\n ^\n[Line: 1, Column: 1]];  
> > > > > > > ","status":400}
> > > > > > > 
> > > > > > > I'm probably missing something, any ideas?  
> > > > > > > Thanks in advance,  
> > > > > > > Or
> > > > > > 
> > > > > > --  
> > > > > > 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.
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/\*\*grou\*\*ps/opt\_out](https://groups.google.com/ **grou** ps/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > > .
> > > > > 
> > > > > --  
> > > > > 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.  
> > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > .
> > > 
> > > --  
> > > 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).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:42am UTC](https://discuss.elastic.co/t/update-api-problem/11392/9 "2017-07-06T02:42:52Z")

</div>


