# Problem with indexed groovy script, bulk API, and shield

**URL:** https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [June 8, 2016, 3:51pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234 "2016-06-08T15:51:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![founderbits](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@founderbits](https://discuss.elastic.co/u/founderbits)
#### Post date: [June 8, 2016, 3:51pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/1 "2016-06-08T15:51:29Z")

</div>

Hello,

I've chosen to enable all indexed scripts for my cluster and am able to put groovy scripts into .scripts with my admin user. (I should mention I setup shield with the default config.)

However, when using the readwrite user, I get the following error when trying to use the script in doing a update operation with the bulk API:

`{'update': {'error': {'type': 'illegal_argument_exception', 'reason': 'failed to execute script', 'caused_by': {'type': 'security_exception', 'reason': 'action [indices:data/read/get] is unauthorized for user [__es_system_user]'}}, '_id': '4d18aa36-126e-42f9-a397-7abae036e3e5', 'status': 400, '_type': 'subscriber', '_index': 'primary'}}`

I am using version 2.3.3 and the first 6 characters of my cluster id are 4523f3.

---

<div class="post-metadata">

### Author: ![igor\_k](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_k/32/1157_2.png) [@igor\_k](https://discuss.elastic.co/u/igor_k)
#### Post date: [June 9, 2016, 2:59pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/2 "2016-06-09T14:59:49Z")

</div>

Hi @founderbits, this seems to be an excellent question for the "X-Pack" category. I've moved the post for you.

Thanks,  
Igor

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [June 10, 2016, 12:40pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/3 "2016-06-10T12:40:31Z")

</div>

Thanks for reporting @founderbits. I am moving this to the Shield discussion category and will take a look into reproducing the issue.

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [June 10, 2016, 4:53pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/4 "2016-06-10T16:53:51Z")

</div>

I tracked down the problem and [opened a PR](https://github.com/elastic/elasticsearch/pull/18816) to fix the issue in elasticsearch

---

<div class="post-metadata">

### Author: ![jordansparked](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jordansparked/32/8495_2.png) [@jordansparked](https://discuss.elastic.co/u/jordansparked)
#### Post date: [June 15, 2016, 10:44pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/5 "2016-06-15T22:44:52Z")

</div>

Hi @jaymode, I've come across this same error on my 2.3.3 cluster, is there an ETA for when 2.3.4 will be available on ES Cloud? Thx!

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [June 16, 2016, 10:55am UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/6 "2016-06-16T10:55:09Z")

</div>

We do not give dates for our releases since there are many unknowns, but the release should be available on cloud immediately once released.

---

<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:44pm UTC](https://discuss.elastic.co/t/problem-with-indexed-groovy-script-bulk-api-and-shield/52234/7 "2017-07-06T13:44:00Z")

</div>


