# Delete those data that have been imported to ES

**URL:** <https://discuss.elastic.co/t/delete-those-data-that-have-been-imported-to-es/148317>\
**Category:** Logstash\
**Created:** [September 12, 2018, 12:20pm UTC](https://discuss.elastic.co/t/delete-those-data-that-have-been-imported-to-es/148317 "2018-09-12T12:20:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganessen23](https://avatars.discourse-cdn.com/v4/letter/g/b5a626/32.png) [@ganessen23](https://discuss.elastic.co/u/ganessen23)\
**Post date:** [September 12, 2018, 12:20pm UTC](https://discuss.elastic.co/t/delete-those-data-that-have-been-imported-to-es/148317/1 "2018-09-12T12:20:14Z")

</div>

Hello,

I am using ELK to import data from an external SQL database server (big data-millions of rows of data).  
I want to delete those data in the SQL server that have been imported to Elasticsearch.  
A prior solution was to create two pipelines:

1. One would import all rows from a certain table in a SQL server.
2. Another that would truncate all data in the table on that SQL server.  
This solution would result to erase all data found in that table even though some rows that have not been imported to Elasticsearch.

My question is: Is there a way to identify which rows from that table have been imported to Elasticsearch so that I can modify my **_jdbc statement_** to delete those data?

```
input {
            jdbc{
                jdbc_driver_library => "/data/sqljdbc_6.0/enu/jre8/sqljdbc42.jar"
                
                jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
                jdbc_connection_string => "jdbc:sqlserver://xx.xx.xx.xx:1433;instanceName=xxx;databasename=xxx"
                jdbc_user => "Elastic"
                jdbc_password => "password"
                schedule => "* * * * *"
                statement => "DELETE FROM TABLE_X WHERE **_condition_**"
				
				
                
        }
}

```

Thanks in advance.  
Ganessen

---

<div class="post-metadata">

**Author:** ![ganessen23](https://avatars.discourse-cdn.com/v4/letter/g/b5a626/32.png) [@ganessen23](https://discuss.elastic.co/u/ganessen23)\
**Post date:** [September 13, 2018, 5:40am UTC](https://discuss.elastic.co/t/delete-those-data-that-have-been-imported-to-es/148317/2 "2018-09-13T05:40:39Z")

</div>

Hello,

Can i have some help here please.

Thanks,  
Ganessen

---

<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 11, 2018, 5:40am UTC](https://discuss.elastic.co/t/delete-those-data-that-have-been-imported-to-es/148317/3 "2018-10-11T05:40:40Z")

</div>

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