# Drop event by field type

**URL:** <https://discuss.elastic.co/t/drop-event-by-field-type/285327>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [September 28, 2021, 8:34am UTC](https://discuss.elastic.co/t/drop-event-by-field-type/285327 "2021-09-28T08:34:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vijayakumar\_Kannan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vijayakumar_kannan/32/34873_2.png) [@Vijayakumar\_Kannan](https://discuss.elastic.co/u/Vijayakumar_Kannan)\
**Post date:** [September 28, 2021, 8:34am UTC](https://discuss.elastic.co/t/drop-event-by-field-type/285327/1 "2021-09-28T08:34:51Z")

</div>

How to drop the indexing event if the field is not integer ? in the below example i had used `123` it works . if i use `abc` that event should drop.

```auto
POST _ingest/pipeline/_simulate
{
  "docs": [
  {
       "_source": {
         "message": """123"""}
     }
  ],
  "pipeline":{
    "description" : "Messaging tracking ingestion",
    "processors" : [
      
      {
        "convert" : {
          "field" : "message",
          "type" : "integer",
          "ignore_missing" : true
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [September 29, 2021, 11:26am UTC](https://discuss.elastic.co/t/drop-event-by-field-type/285327/2 "2021-09-29T11:26:18Z")

</div>

I would try this.

```auto
    "processors": [
      {
        "drop": {
          "if": """
            !ctx.message.chars().allMatch( Character::isDigit )
          """
        }
      }
    ]

```

---

<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:** [October 27, 2021, 11:26am UTC](https://discuss.elastic.co/t/drop-event-by-field-type/285327/3 "2021-10-27T11:26:45Z")

</div>

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