# The best way to automatically delete data from certain index by list of IDs

**URL:** <https://discuss.elastic.co/t/the-best-way-to-automatically-delete-data-from-certain-index-by-list-of-ids/122701>\
**Category:** Logstash\
**Created:** [March 6, 2018, 11:06am UTC](https://discuss.elastic.co/t/the-best-way-to-automatically-delete-data-from-certain-index-by-list-of-ids/122701 "2018-03-06T11:06:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikhail](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@Mikhail](https://discuss.elastic.co/u/Mikhail)\
**Post date:** [March 6, 2018, 11:06am UTC](https://discuss.elastic.co/t/the-best-way-to-automatically-delete-data-from-certain-index-by-list-of-ids/122701/1 "2018-03-06T11:06:40Z")

</div>

Hi,

Could you please help me with the following.

I have some SQL environment that consists of:

- Table1. It is main table with data. Here I have unique identifier SKID of each entry.
- Table2. Accumulates SKIDs of entries that were deleted from table1.
- SQL procedure that manages these two tables. It inserts/updates/deletes data in table1 and inserts list of deleted SKIDs into table2.

In ElasticSearch I have an index1 that is filled by Logstash with data from table1 via `jdbc input plugin`.  
Now I'm looking for the way to make Logstash get the list of deleted SKIDs from table2 and delete entries with same SKIDs in index1.  
How can I reach this?

P.S. If it makes sense, I use ELK stack version 6.1.3.

---

<div class="post-metadata">

**Author:** ![Mikhail](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@Mikhail](https://discuss.elastic.co/u/Mikhail)\
**Post date:** [March 12, 2018, 2:29pm UTC](https://discuss.elastic.co/t/the-best-way-to-automatically-delete-data-from-certain-index-by-list-of-ids/122701/2 "2018-03-12T14:29:34Z")

</div>

Any suggestions?

---

<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:** [April 9, 2018, 2:29pm UTC](https://discuss.elastic.co/t/the-best-way-to-automatically-delete-data-from-certain-index-by-list-of-ids/122701/3 "2018-04-09T14:29:42Z")

</div>

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