# How to drop Document on FailureAction

**URL:** <https://discuss.elastic.co/t/how-to-drop-document-on-failureaction/240327>\
**Category:** Elasticsearch\
**Created:** [July 8, 2020, 11:06am UTC](https://discuss.elastic.co/t/how-to-drop-document-on-failureaction/240327 "2020-07-08T11:06:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhaskar3184](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@Bhaskar3184](https://discuss.elastic.co/u/Bhaskar3184)\
**Post date:** [July 8, 2020, 11:06am UTC](https://discuss.elastic.co/t/how-to-drop-document-on-failureaction/240327/1 "2020-07-08T11:06:20Z")

</div>

Hi,

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/d/6dc108edc1e23b4b7ed28c2b8995cb310b082786.png)

I am new to ELK, and trying to send the JSON data to elasticsearch, if the JSON format is given wrongly the Es is adding a document with "-".  
Can you please help me in avoiding the wrong input JSON.

My script:

* * *

input {  
file {  
path =\> ["/dev/elk/data/sample.json"]  
start\_position =\> "beginning"  
discover\_interval =\> 10  
stat\_interval =\> 10  
sincedb\_write\_interval =\> 10  
close\_older =\> 10  
codec =\> multiline {  
pattern =\> "\n"  
negate =\> true  
what =\> "previous"  
}  
}  
}

filter {  
json {  
source =\> "message"  
tag\_on\_failure =\> ["\_jsonparsefailure"]  
skip\_on\_invalid\_json =\> false  
ignore\_failure =\> false  
if "\_jsonparsefailure" in [tags] {  
drop { }  
}

}  
}

output {  
if "\_jsonparsefailure" not in [tags] {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "index1"  
document\_type =\> "indexdoc1"  
}  
}

---

<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, 11:06am UTC](https://discuss.elastic.co/t/how-to-drop-document-on-failureaction/240327/2 "2020-08-05T11:06:37Z")

</div>

Closed on August 5, 2020, 11:06am UTC

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