# Update return 500 and npe

**URL:** https://discuss.elastic.co/t/update-return-500-and-npe/19029
**Category:** Elasticsearch
**Created:** [August 1, 2014, 1:40pm UTC](https://discuss.elastic.co/t/update-return-500-and-npe/19029 "2014-08-01T13:40:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fancyerii](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fancyerii](https://discuss.elastic.co/u/fancyerii)
#### Post date: [August 1, 2014, 1:40pm UTC](https://discuss.elastic.co/t/update-return-500-and-npe/19029/1 "2014-08-01T13:40:44Z")

</div>

I am using 0.90.13.

$ curl -XGET [http://localhost:9200/blog/article/1?pretty](http://localhost:9200/blog/article/1?pretty)

{

"\_index" : "blog",

"\_type" : "article",

"\_id" : "1",

"\_version" : 3,

"exists" : true, "\_source" : {"title":"New version of Elasticsearch  
released!","content":"new  
content","tags":["announce","elasticsearch","release"],"counter":1}

}

curl -XPOST [http://localhost:9200/blog/article/1/\_update](http://localhost:9200/blog/article/1/_update) -d  
'"script":"ctx.\_source.counter += 2"'

{"error":"NullPointerException[null]","status":500}

what's wrong?

--  
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/b32bb63f-6097-438e-bfc7-1c2dfea22cbf%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b32bb63f-6097-438e-bfc7-1c2dfea22cbf%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![fancyerii](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fancyerii](https://discuss.elastic.co/u/fancyerii)
#### Post date: [August 2, 2014, 1:43am UTC](https://discuss.elastic.co/t/update-return-500-and-npe/19029/2 "2014-08-02T01:43:45Z")

</div>

I found the problem, it should be json object

curl -XPOST [http://localhost:9200/blog/article/1/\_update](http://localhost:9200/blog/article/1/_update) -d '{"script":"ctx.\_source.counter  
+= 2"}'

On Friday, August 1, 2014 9:40:44 PM UTC+8, [fanc...@gmail.com](mailto:fanc...@gmail.com) wrote:

> I am using 0.90.13.
> 
> $ curl -XGET [http://localhost:9200/blog/article/1?pretty](http://localhost:9200/blog/article/1?pretty)
> 
> {
> 
> "\_index" : "blog",
> 
> "\_type" : "article",
> 
> "\_id" : "1",
> 
> "\_version" : 3,
> 
> "exists" : true, "\_source" : {"title":"New version of Elasticsearch  
> released!","content":"new  
> content","tags":["announce","elasticsearch","release"],"counter":1}
> 
> }
> 
> curl -XPOST [http://localhost:9200/blog/article/1/\_update](http://localhost:9200/blog/article/1/_update) -d  
> '"script":"ctx.\_source.counter += 2"'
> 
> {"error":"NullPointerException[null]","status":500}
> 
> what's wrong?

--  
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/a781a1ea-8f50-47d2-b2bb-83f0f9c656c0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a781a1ea-8f50-47d2-b2bb-83f0f9c656c0%40googlegroups.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:11am UTC](https://discuss.elastic.co/t/update-return-500-and-npe/19029/3 "2017-07-06T01:11:29Z")

</div>


