# Synchronization between two index documents

**URL:** <https://discuss.elastic.co/t/synchronization-between-two-index-documents/6787>\
**Category:** Elasticsearch\
**Created:** [February 23, 2012, 11:06am UTC](https://discuss.elastic.co/t/synchronization-between-two-index-documents/6787 "2012-02-23T11:06:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![narinder\_izap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/narinder_izap/32/803_2.png) [@narinder\_izap](https://discuss.elastic.co/u/narinder_izap)\
**Post date:** [February 23, 2012, 11:06am UTC](https://discuss.elastic.co/t/synchronization-between-two-index-documents/6787/1 "2012-02-23T11:06:12Z")

</div>

Hi,

i am using two indexes, one is for the main entity, and other for the  
entities relationships having the following structure:

_main index:_

{  
guid:1,  
title:abc,  
........  
}

{  
guid:2,  
title:xyz,  
........  
}

\*Relations index \*

{  
guid\_1: 1,  
guid2\_: 2,  
relation: friend  
........  
}

Now if the enity(guid:1 or guid:2) in the main index is deleted, then the  
relation must be deleted as well, but these two types are in different  
indexes,so i have to trigger the deletion from the two indices, but even  
then there are some relations documents left whose main document has been  
deleted. so i want to know if its possible to get something like garbage  
collector, which will remove all the relation document whose main document  
in main index does not exist anymore.

Thanks

---

<div class="post-metadata">

**Author:** ![Nick\_Hoffman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_hoffman/32/1872_2.png) [@Nick\_Hoffman](https://discuss.elastic.co/u/Nick_Hoffman)\
**Post date:** [February 23, 2012, 11:06pm UTC](https://discuss.elastic.co/t/synchronization-between-two-index-documents/6787/2 "2012-02-23T23:06:11Z")

</div>

You might be able to issue 2 DELETEs using the new multi-search query in  
0.19 .  
[http://www.elasticsearch.org/blog/2012/02/21/0.19.0.RC3-released.html](http://www.elasticsearch.org/blog/2012/02/21/0.19.0.RC3-released.html)

> <https://github.com/elastic/elasticsearch/issues/1722>

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 24, 2012, 9:04am UTC](https://discuss.elastic.co/t/synchronization-between-two-index-documents/6787/3 "2012-02-24T09:04:14Z")

</div>

On Thu, 2012-02-23 at 15:06 -0800, Nick Hoffman wrote:

> You might be able to issue 2 DELETEs using the new multi-search query  
> in 0.19 .  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/2012/02/21/0.19.0.RC3-released.html)
> 
> [API: Multi Search · Issue #1722 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1722)

The msearch is for search only.

However, you could do a delete-by-query. Or use the new update API to  
remove a guid from a relationship (in case you have multiple values and  
only want to remove one of them)

---

<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:** [July 6, 2017, 3:38am UTC](https://discuss.elastic.co/t/synchronization-between-two-index-documents/6787/4 "2017-07-06T03:38:27Z")

</div>


