# Partial Update Document without script

**URL:** https://discuss.elastic.co/t/partial-update-document-without-script/24508
**Category:** Elasticsearch
**Created:** [June 28, 2015, 3:10pm UTC](https://discuss.elastic.co/t/partial-update-document-without-script/24508 "2015-06-28T15:10:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tushar\_chevulkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tushar_chevulkar/32/46270_2.png) [@tushar\_chevulkar](https://discuss.elastic.co/u/tushar_chevulkar)
#### Post date: [June 28, 2015, 3:10pm UTC](https://discuss.elastic.co/t/partial-update-document-without-script/24508/1 "2015-06-28T15:10:23Z")

</div>

I am using the following code for partial update

```
POST /website/blog/1/_update
{
   "script" : "ctx._source.views+=1"
} 

```

is there any alternative way I can achieve the same thing. because I don't want to change anything in  
groovy script because last time I changed the settings and my server was compromised.

So someone please help me with the solution or some security measures if there is no work around.

---

<div class="post-metadata">

### Author: ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)
#### Post date: [September 10, 2015, 4:25pm UTC](https://discuss.elastic.co/t/partial-update-document-without-script/24508/2 "2015-09-10T16:25:18Z")

</div>

Hi,  
sorry about the late answer. Instead of using the update , you can always get the document back and manually update it. Just beware that what the update api does internally is still a get+reindex, just slightly optimized compared to what you'd do manually.

If you do want to use groovy scripting, that means dynamic scripts need to be enabled. That said your server should never ever be exposed to the internet, besides whether scripts are enabled or not. Also make sure that the elasticsearch process doesn't run with root but with its own proper user.

If you need actual security features, you can have a look at shield, the security product developed by elastic itself.

---

<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 5, 2017, 11:51pm UTC](https://discuss.elastic.co/t/partial-update-document-without-script/24508/3 "2017-07-05T23:51:09Z")

</div>


