# Help with an if statement in a drop processor

**URL:** <https://discuss.elastic.co/t/help-with-an-if-statement-in-a-drop-processor/280824>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [August 9, 2021, 3:25pm UTC](https://discuss.elastic.co/t/help-with-an-if-statement-in-a-drop-processor/280824 "2021-08-09T15:25:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjammin92](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jjammin92](https://discuss.elastic.co/u/jjammin92)\
**Post date:** [August 9, 2021, 3:25pm UTC](https://discuss.elastic.co/t/help-with-an-if-statement-in-a-drop-processor/280824/1 "2021-08-09T15:25:36Z")

</div>

Hello,

I am looking to create a conditional in an elasticsearch drop processor and running into some trouble. This should be rather simple I think, I'm just missing something obvious.

I would like to accept all documents if field `task eq 356`

I would like to accept documents if `task eq 506` AND `total_consumption > 95`

This is some code I'm trying but its throwing formatting errors:

`if (ctx.task != 356) || (ctx.task != 506 && ctx.total_consumption < 95)`

---

<div class="post-metadata">

**Author:** ![jjammin92](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jjammin92](https://discuss.elastic.co/u/jjammin92)\
**Post date:** [August 9, 2021, 7:52pm UTC](https://discuss.elastic.co/t/help-with-an-if-statement-in-a-drop-processor/280824/2 "2021-08-09T19:52:52Z")

</div>

just bumping

---

<div class="post-metadata">

**Author:** ![jjammin92](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jjammin92](https://discuss.elastic.co/u/jjammin92)\
**Post date:** [August 10, 2021, 9:25pm UTC](https://discuss.elastic.co/t/help-with-an-if-statement-in-a-drop-processor/280824/3 "2021-08-10T21:25:16Z")

</div>

just bumping

---

<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:** [September 7, 2021, 9:26pm UTC](https://discuss.elastic.co/t/help-with-an-if-statement-in-a-drop-processor/280824/4 "2021-09-07T21:26:12Z")

</div>

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