# Remove from \_source.fieldA if fieldA is zero

**URL:** <https://discuss.elastic.co/t/remove-from-source-fielda-if-fielda-is-zero/288961>\
**Category:** Elasticsearch\
**Created:** [November 11, 2021, 7:55am UTC](https://discuss.elastic.co/t/remove-from-source-fielda-if-fielda-is-zero/288961 "2021-11-11T07:55:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon17386273](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@anon17386273](https://discuss.elastic.co/u/anon17386273)\
**Post date:** [November 11, 2021, 7:55am UTC](https://discuss.elastic.co/t/remove-from-source-fielda-if-fielda-is-zero/288961/1 "2021-11-11T07:55:16Z")

</div>

Hi

I am using ES 7.10.2 and wanted to remove from existing indices \_source fieldA if fieldA is zero.  
I tried to use update\_by\_query \> pipeline \> processor \> remove to remove a field if it's value is zero but when I ran the update\_by\_query with pipeline, i encountered null\_pointer\_exception  
reason: Cannot Invoke "Object.getClass()" because "callArgs[0]" is null"

Below is my code for ingest pipeline

```auto
PUT _ingest/pipeline/set_fieldA_null
{
   "description" : "set fieldA from zero to null",
   "processors": [
   {
      "remove": {
          "if": "ctx._source.fieldA == 0",
          "field": "ctx._source.fieldA"
      }
   }
   ]
}

```

Below is my API call  
`POST myindexA/_update_by_query?pipeline=set_fieldA_null`

Any help is appreciated

---

<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:** [December 9, 2021, 7:55am UTC](https://discuss.elastic.co/t/remove-from-source-fielda-if-fielda-is-zero/288961/2 "2021-12-09T07:55:48Z")

</div>

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