# Painless Script from Java Client

**URL:** <https://discuss.elastic.co/t/painless-script-from-java-client/184125>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [June 4, 2019, 8:58am UTC](https://discuss.elastic.co/t/painless-script-from-java-client/184125 "2019-06-04T08:58:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesco\_Centrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francesco_centrone/32/45311_2.png) [@Francesco\_Centrone](https://discuss.elastic.co/u/Francesco_Centrone)\
**Post date:** [June 4, 2019, 8:58am UTC](https://discuss.elastic.co/t/painless-script-from-java-client/184125/1 "2019-06-04T08:58:41Z")

</div>

Hello,

I am trying to use the painless script to edit/remove element from a list in a document. Everything works correctly but I am not able to know if the element was actually edited or removed.  
i.e. I need to know in case the element was not present already while deleting.

Is there a way to throw an error or return a value? I am using a Java Client

Thank you,  
Francesco

---

<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 2, 2019, 8:58am UTC](https://discuss.elastic.co/t/painless-script-from-java-client/184125/2 "2019-07-02T08:58:43Z")

</div>

Closed on July 2, 2019, 8:58am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
