# Delete documents loaded in the index in elastic via logstash

**URL:** <https://discuss.elastic.co/t/delete-documents-loaded-in-the-index-in-elastic-via-logstash/213624>\
**Category:** Logstash\
**Created:** [January 2, 2020, 8:34pm UTC](https://discuss.elastic.co/t/delete-documents-loaded-in-the-index-in-elastic-via-logstash/213624 "2020-01-02T20:34:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elvis\_Goncalves](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elvis_goncalves/32/42379_2.png) [@Elvis\_Goncalves](https://discuss.elastic.co/u/Elvis_Goncalves)\
**Post date:** [January 2, 2020, 8:34pm UTC](https://discuss.elastic.co/t/delete-documents-loaded-in-the-index-in-elastic-via-logstash/213624/1 "2020-01-02T20:34:29Z")

</div>

I am using the following configuration file, but it does not delete the CUITS numbers that I get from my SQL database in the elasticsearch index.

This is the code in the file

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:sqlserver://172.30.1.74;databaseName=DW"  
jdbc\_user =\> "user"  
jdbc\_password =\> "password"  
jdbc\_validate\_connection =\> true  
jdbc\_driver\_library =\> "/home/ec2-user/logstash-6.5.4/driverJDBC/sqljdbc42.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
statement =\> "SELECT \* from DELETE\_ELASTIC"  
}  
}  
output {  
amazon\_es {  
hosts =\> ["[https://search-dataqa-p4w23l3f76cdt7mjkwgvao6rhy.us-east-1.es.amazonaws.com](https://search-dataqa-p4w23l3f76cdt7mjkwgvao6rhy.us-east-1.es.amazonaws.com)"]  
region =\> "us-east-1"  
aws\_access\_key\_id =\> 'Acceskey'  
aws\_secret\_access\_key =\> 'secretkey'  
action =\> "delete"  
index =\> "enriquecimiento"  
document\_type =\> "personas"  
document\_id =\> "%{cuitnumero}"  
}  
}

---

<div class="post-metadata">

**Author:** ![Rob\_wylde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rob_wylde/32/58231_2.png) [@Rob\_wylde](https://discuss.elastic.co/u/Rob_wylde)\
**Post date:** [January 5, 2020, 4:39am UTC](https://discuss.elastic.co/t/delete-documents-loaded-in-the-index-in-elastic-via-logstash/213624/2 "2020-01-05T04:39:27Z")

</div>

I have not used the jdbc driver input module, but if you want to remove data you should be using a filter{} block with mutate remove\_field or similar to do it.

---

<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:** [February 2, 2020, 4:39am UTC](https://discuss.elastic.co/t/delete-documents-loaded-in-the-index-in-elastic-via-logstash/213624/3 "2020-02-02T04:39:27Z")

</div>

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