# Problem removing nested object using UpdateByQuery

**URL:** <https://discuss.elastic.co/t/problem-removing-nested-object-using-updatebyquery/240409>\
**Category:** Elasticsearch\
**Created:** [July 8, 2020, 5:15pm UTC](https://discuss.elastic.co/t/problem-removing-nested-object-using-updatebyquery/240409 "2020-07-08T17:15:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maynestream](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maynestream/32/71829_2.png) [@maynestream](https://discuss.elastic.co/u/maynestream)\
**Post date:** [July 8, 2020, 5:15pm UTC](https://discuss.elastic.co/t/problem-removing-nested-object-using-updatebyquery/240409/1 "2020-07-08T17:15:25Z")

</div>

Hi all,

Apologies if there are similar answers, I have extensively searched, but this does appear to be quite a niche problem.

As the title suggests, I have a scenario where I am using UpdateByQuery (java API) using groovy script (I know...) and a simple filter against a ES version 2.3.3 cluster (yes, I know...). This script removes an element from a nested list similar to

```auto
ctx._source.tags.removeAll{it.id == remove_id}

```

This works perfectly in our integration tests, and running against a single node local cluster on my machine, but fails to actually remove the item in a deployed environment (no errors/exceptions etc. the filter and script execute, it just doesn't update any documents. I _have_ verified the contents of the filter/script in those environments; the filter does match documents, and the script _should_ remove the item).

The only known difference between these 2 clusters is that my local version runs 2.4. Is it expected that behaviour between these 2 versions would differ in this way? Is it possible there are cluster settings that would modify this behaviour? Are there caches that would affect this?

Any help is greatly appreciated.

Thanks,  
Chris

---

<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:** [August 5, 2020, 5:30pm UTC](https://discuss.elastic.co/t/problem-removing-nested-object-using-updatebyquery/240409/2 "2020-08-05T17:30:23Z")

</div>

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