# Remove documents with certain conditions based on what exists in another index

**URL:** <https://discuss.elastic.co/t/remove-documents-with-certain-conditions-based-on-what-exists-in-another-index/210740>\
**Category:** Elasticsearch\
**Created:** [December 5, 2019, 4:01pm UTC](https://discuss.elastic.co/t/remove-documents-with-certain-conditions-based-on-what-exists-in-another-index/210740 "2019-12-05T16:01:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johanwallenborg](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@johanwallenborg](https://discuss.elastic.co/u/johanwallenborg)\
**Post date:** [December 5, 2019, 4:01pm UTC](https://discuss.elastic.co/t/remove-documents-with-certain-conditions-based-on-what-exists-in-another-index/210740/1 "2019-12-05T16:01:44Z")

</div>

Today I have two indices (Lets call them A and B).

Index A contains "rawdata" and Index B is a simple index with one column with different values. What I want to do is to remove or mark documents if it contains values that exists in Index B.

Is this possible?  
Should I use Python API for this?  
Or should I do this in an earlier stage with logstash and/or filebeat?

---

<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:** [January 2, 2020, 4:01pm UTC](https://discuss.elastic.co/t/remove-documents-with-certain-conditions-based-on-what-exists-in-another-index/210740/2 "2020-01-02T16:01:51Z")

</div>

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