# Send same document to multiple elasticsearch indexes

**URL:** <https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702>\
**Category:** Logstash\
**Created:** [March 11, 2019, 8:57am UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702 "2019-03-11T08:57:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Praneet\_Khandelwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praneet_khandelwal/32/40565_2.png) [@Praneet\_Khandelwal](https://discuss.elastic.co/u/Praneet_Khandelwal)\
**Post date:** [March 11, 2019, 8:57am UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702/1 "2019-03-11T08:57:20Z")

</div>

I am processing incoming documents via logstash. And I would like to send the documents to different multiple indices. I have found this approach to solve the problem.

```auto
output {   
    elasticsearch {  
        host => "localhost"  
        protocol => "http"  
        index => "first_indexer"   
    }
    elasticsearch {  
        host => "localhost"  
        protocol => "http"  
        index => "second_indexer"   
    }
} 

```

I have the following doubt with this approach:  
If a document gets an error(lets say mapping parser exception) while indexing in the first index, will it not index in the second index? And what happens to the documents that come after that.

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [March 11, 2019, 7:36pm UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702/2 "2019-03-11T19:36:51Z")

</div>

What your describing is done by design.  
If one output fails then the entire execution of that pipeline will fail. This is done to prevent any sort of queueing or backpressure on logstash.  
You may want to look into cross cluster index replication.

Why do you have so many clusters in the first place?

---

<div class="post-metadata">

**Author:** ![Praneet\_Khandelwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praneet_khandelwal/32/40565_2.png) [@Praneet\_Khandelwal](https://discuss.elastic.co/u/Praneet_Khandelwal)\
**Post date:** [March 12, 2019, 6:32am UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702/3 "2019-03-12T06:32:33Z")

</div>

Thanks for the response.  
We have only a single cluster. But have different indices. And we need to send same documents to those different indices.

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [March 12, 2019, 12:46pm UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702/4 "2019-03-12T12:46:48Z")

</div>

Why would you want to do that?  
Sorry for all the questions, I'm just trying to understand your use case.

---

<div class="post-metadata">

**Author:** ![Praneet\_Khandelwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/praneet_khandelwal/32/40565_2.png) [@Praneet\_Khandelwal](https://discuss.elastic.co/u/Praneet_Khandelwal)\
**Post date:** [March 12, 2019, 12:50pm UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702/5 "2019-03-12T12:50:32Z")

</div>

Yeah let me explain why I am doing that.  
Actually I was performing reindexing on my data. And I have completed the reindexing from my "old\_index" to "new\_index" but before shifting entirely to the "new\_index", I would like to see if the mapping I defined in the "new\_index" working fine for a few days and so I want the data to still be indexed in the "old\_index" also. I hopw this makes sense .

---

<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, 2019, 12:50pm UTC](https://discuss.elastic.co/t/send-same-document-to-multiple-elasticsearch-indexes/171702/6 "2019-04-09T12:50:34Z")

</div>

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